The Irish Government has won its appeal against a European Union decision that determined that Ireland gave Apple illegal state aid and that the technology company subsequently owed the state €13.1 billion.

The European Commission declared in 2016 that Ireland had granted Apple Sales International (ASI) and Apple Operations Europe (AOE) a selective economic advantage and state aid. 

However, a ruling by the EU's General Court in Luxembourg, the EU's second-highest court, found that the Commission did not prove "to the requisite legal standard" that Ireland had granted tax advantages to Apple. 

The Commission may still appeal the General Court's decision in the EU's Court of Justice, its highest court, but it could take a further three years before the court reaches a verdict.

The Commission based its original decision on a ruling from the Irish Government that allowed Apple to channel its revenue through head office divisions of two subsidiaries - ASI and AOE.  

Both ASI and AOE are based in Cork and both are non-resident companies for tax purposes, according to the Irish Times. 

Only taxes allocated to Irish branches within those subsidiaries were taxed in Ireland and the Commission contended that all profits of the two subsidiaries were taxable in Ireland. 

The commission additionally argued that the Irish Government did not implement a proper method for allocating taxable profits to Apple's Irish branches. 

Apple and the Irish Government, on the other hand, argued in the General Court that most of the profits - and taxes - were due in the US since the bulk of Apple products were created, designed, and engineered there. 

Read more: Elizabeth Warren weighs in on Ireland’s Apple tax standoff

The General Court found in favor of Ireland and Apple in Wednesday's verdict, arguing that the Commission had incorrectly concluded that Ireland had granted Apple an unfair tax advantage. The court additionally found that the Commission did not provide evidence to prove that Ireland's method for allocating taxable profits was flawed. 

The Irish Department of Finance welcomed the General Court's verdict in a statement on Wednesday. 

The Department said: "Ireland has always been clear that there was no special treatment provided to the two Apple companies - ASI and AOE. The correct amount of Irish tax was charged... in line with normal Irish taxation rules.

"Ireland appealed the commission decision on the basis that Ireland granted no State aid and the decision today from the court supports that view."

In 2016, the Irish Government, then led by Enda Kenny and Fine Gael, decided to appeal the Commission's decision, a move that was criticized by Sinn Féin and the Green Party. 

Sinn Féin, in particular, has long argued that the Apple tax money should be used on a number of social issues. 

However, key figures in the Irish Government believed that an unsuccessful appeal would make Ireland less attractive to multinational companies, which create thousands of jobs in Ireland. 

Apple, for example, employs 6,000 people in its Cork headquarters.

The company said that it was pleased with the court's verdict. 

"This case was not about how much tax we pay, but where we are required to pay it," the company said in a statement. 

"We're proud to be the largest taxpayer in the world as we know the important role tax payments play in society.

"Apple has paid more than $100 billion in corporate income taxes around the world in the last decade and tens of billions more in other taxes." 

The €13.1 billion had been held in a temporary escrow account until the General Court reached its verdict. 

Read more: Apple tax ruling sees tech company start to hand €13 billion in unpaid taxes over to Ireland