Updated

In a ruling handed down this morning, Apple was given a $14.5 billion bill for back taxes by the European Commission, related to its business in Europe and Ireland. Apple's tax situation, including the hundreds of billions in cash held offshore, has always been a hot topic for the company. But how did it land in this mess, and who does it even owe money to anyway?

The situation right now is a little unclear. This morning's ruling was given by the European Commission, which says that both Apple and Ireland made a tax arrangement against the rules of the E.U. As a result, Apple owes money to Ireland, but the country disagrees. In a statement, the Finance Minister said he "disagrees profoundly" with the E.C.'s ruling, and will appeal.

As you might expect, Apple is also planning on launching an appeal. CEO Tim Cook argues that because Apple complied with Irish tax authorities, there shouldn't be any penalties applied, and Cook is confident that Apple's case will "ultimately prevail." Oh, and the U.S. government is also on Apple's side, accusing the E.U. in a statement last week of acting as a "supra-national tax authority."

In other words, we have the stage set for one hell of a fight. In one corner, the European Commission, a powerful international body with the backing of all the E.U. member states (except Ireland), who are tired of having Apple pay very little tax on billions in sales. In the other, we have the world's largest corporation, the U.S. Treasury Department, and an Irish government that really doesn't want to be labelled as a tax haven.

More From BGR

Apple's tax arrangement

What the sides ultimately disagree on is how Apple's taxes are structured through Ireland. It's a complicated arrangement used by hundreds of big companies aside from Apple, but it works something like this. Apple Sales International and Apple Operations Europe are two Irish-registered companies, which hold the intellectual property to Apple products and brands outside of North and South America.

Using legal tax mechanisms, all sales of Apple products in Europe went to these companies, so the bulk of all profits made in Europe ended up in Ireland. Using transfer pricing like this to funnel profits into a particular country is a legal and well-used (if ethically dubious) practice.

The real problem is how profits were taxed once they got to Ireland. Apple and Ireland agreed on a system that channeled "most profits...away from Ireland to a 'head office' within Apple Sales International," according to the E.C. The Commission's investigation showed that Apple had been given a tax rate as low as 0.005 percent at some points, far lower than the already-low Irish corporation tax rate of 12.5 percent.

So whose rules did Apple break?

The E.U.'s involvement makes this a weird case. Normally, tax evasion is pretty cut-and-dry: a country has rules on tax, a corporation breaks them, and then the company is found out and has to pay up. But in this case, Apple was in compliance with Ireland's rules. It was Ireland's rules that were out of line with the E.U.'s taxation policies, which don't allow member states to act as tax havens.

So Apple has to pay back taxes to Ireland, but Ireland doesn't want the money. Directly after the Commission released its findings, Irish Finance Minister Michael Noonan released a statement, saying "I disagree profoundly with the Commission's decision," and that he has "no choice but to seek Cabinet approval to appeal the decision before the European Courts. This is necessary to defend the integrity of our tax system; to provide tax certainty to business; and to challenge the encroachment of E.U. state aid rules into the sovereign Member State competence of taxation."

What does Apple say?

Obviously, Apple isn't happy about the ruling. Tim Cook issued an open letter to customers this morning, seeking to reassure them. In it, he restates Apple's long-running justification of the Irish tax arrangements. Cook points out that Apple has had a tangible presence in Ireland for decades, starting with a factory with 60 employees in Cork, Ireland back in 1980.

He goes on to say that "over the years, we received guidance from Irish tax authorities on how to comply correctly with Irish tax law -- the same kind of guidance available to any company doing business there. In Ireland and in every country where we operate, Apple follows the law and we pay all the taxes we owe."

Cook's final argument goes back to one of the principles of taxation, that "a company's profits should be taxed in the country where the value is created." Since Apple's R&D is mostly done in California, Cook argues, that's where Apple should be taxed.

They're all powerful-sounding arguments, but most don't apply to this ruling. Apple does have a physical presence in Ireland, but its low taxation rate really depends on the existence of a "head office" in the country that coordinates worldwide sales. According to the E.C. investigation, the head office exists on paper only.

The fact that Apple was in accordance with Irish tax law is also a moot point. The European Commission objects to Ireland's own taxation policies, claiming they're out of line with E.U. rules. You can see the point: the E.U. is a free trade zone, so if one country can manipulate its taxation code to offer low rates to multinationals, it's offering all of the benefits of a tax haven while also being inside the world's biggest single market.

Cook's final argument also ignores some important facts -- mainly that if Apple should be taxed where it creates the value (R&D in California), why are hundreds of billions of dollars sitting offshore?

What about the US government?

The US Treasury Department has been unusually vocal about this case, in statements last week and also after the ruling was handed down today. Mostly, the Department objects to retroactive taxation, which is says is "unfair, contrary to well-established legal principles, and call into question the tax rules of individual Member States."

So what happens next?

After the international hand-wringing is done, Apple is highly unlikely to just sit down and pay up. (Although it's worth mentioning that the $14.5 billion back tax bill is barely 10 percent of Apple's offshore tax holdings.) Both Apple and Ireland have said they will appeal the decision. Given that E.U. bureaucracy moves at a truly glacial pace, and the first investigation took three years, don't expect this to be settled soon.

But there is also a very good chance Apple ends up paying some money from this. Ireland and the United States may well disagree with the ruling, but public opinion in the 27 other E.U. member states is on the other side. Ireland offering favourable rates has enabled dozens of other high-profile multinationals like Starbucks and Google to avoid paying taxes in other countries.