The European Commission has concluded that Ireland granted undue tax benefits of up to €13bn to Apple.

The commission said "selective treatment" allowed Apple to pay a tax rate of 1% on European Union profits in 2003 down to 0.005% in 2014.

The findings are a result of the culmination of a three-year investigation by Competition Commissioner Margrethe Vestager into tax arrangements for Apple, dating back 25 years.

In a statement, the EC said the benefit is "illegal under EU state aid rules, because it allowed Apple to pay substantially less tax than other businesses. Ireland must now recover the illegal aid."

Both the Government and the company have strenuously denied any wrongdoing.

The Revenue Commissioners is to collect the additional tax deemed to be owed by Apple and the money will be managed by the National Treasury Management Agency.

"Member states cannot give tax benefits to selected companies - this is illegal under EU state aid rules," the commissioner said.

"The Commission's investigation concluded that Ireland granted illegal tax benefits to Apple, which enabled it to pay substantially less tax than other businesses over many years."

At the centre of the Apple controversy are two of the company’s subsidiaries, Apple Operations Europe and Apple Sales International.

These firms were registered in Ireland, however, they were controlled in the US where they held their board meetings.

Revenue taxed the companies on the basis of their activities in Ireland, however, the Commission says both companies should have been taxed by Ireland on the basis of their worldwide income.

The ruling applies to the companies’ activities from 2004 to 2014.

Revenue has been mandated to calculate the amount of outstanding tax due.

In a statement, Apple said it will appeal the ruling and is "confident the decision will be overturned".

"The Commission's case is not about how much Apple pays in taxes, it's about which government collects the money."

The Government has said it "disagrees profoundly" with the Commission’s analysis and will immediately appeal any negative outcome to the European Court of Justice.

The EC said the treatment endorsed a way to establish the taxable profits for two Irish incorporated companies of the Apple group (Apple Sales International and Apple Operations Europe), which did not correspond to economic reality: almost all sales profits recorded by the two companies were internally attributed to a 'head office'.

"The Commission's assessment showed that these 'head offices' existed only on paper and could not have generated such profits.

"These profits allocated to the 'head offices' were not subject to tax in any country under specific provisions of the Irish tax law, which are no longer in force.

"As a result of the allocation method endorsed in the tax rulings, Apple only paid an effective corporate tax rate that declined from 1% in 2003 to 0.005% in 2014 on the profits of Apple Sales International." 

The commission said the tax treatment in Ireland enabled Apple to avoid taxation on almost all profits generated by sales of Apple products in the entire EU Single Market.

"This is due to Apple's decision to record all sales in Ireland rather than in the countries where the products were sold. This structure is however outside the remit of EU state aid control. If other countries were to require Apple to pay more tax on profits of the two companies over the same period under their national taxation rules, this would reduce the amount to be recovered by Ireland.

A spokesperson for the European Commission has said that under EU rules it would be "recommended" that any revenue recouped from Apple be used to reduce the national debt. 

However, this would simply be a recommendation and could not be legally enforced. Under the so-called European Semester each member state receives Country Specific Recommendations on their budget planning.

Since Ireland emerged from its bailout and the so-called Excessive Deficit Procedure, such recommendations are advisory and not legally binding, according to a commission source.

The €13bn Apple has been ordered to repay is expected to be placed in an escrow account pending the Irish government's appeal to the European Court of Justice.

That process could take several years.