UPDATE: 7:30 a.m. EDT — Apple CEO Tim Cook posted an open letter on the company’s website, responding to the European Commission ruling, in which he said it will affect investments and job-creating in Europe.

“The Commission’s move is unprecedented and it has serious, wide-reaching implications. It is effectively proposing to replace Irish tax laws with a view of what the Commission thinks the law should have been. This would strike a devastating blow to the sovereignty of EU member states over their own tax matters, and to the principle of certainty of law in Europe. Ireland has said they plan to appeal the Commission’s ruling and Apple will do the same. We are confident that the Commission’s order will be reversed.”

UPDATE: 6:30 a.m. EDT — Reacting to the EU ruling against Apple Inc., the company said in a statement: “Apple follows the law and pays all of the taxes we owe wherever we operate. We will appeal and we are confident the decision will be overturned.”

Original story:

The European Commissioner for Competition Margrethe Vestager announced Tuesday an EU ruling against Ireland and its tax deal with Apple Inc., which allowed the Cupertino, California, company to save billions of dollars in tax from its European earnings. Vestager said the commission imposed a fine of up to 13 billion euros ($14.5 billion) on Apple, money that will eventually go to the Irish government.

Speaking at a press conference, Vestager said: “Ireland granted illegal tax benefits to Apple, which enabled it to pay substantially less tax than other businesses over many years.”

Apple has its European headquarters in Ireland and a tax deal the company reached with the Irish government allows it to pay tax on its European sales at rates even lower than 1 percent, compared to the normal rate of 12.5 percent corporate tax in Ireland and 35 percent in the United States. According to the European Commission, the deal gives Apple an unfair advantage over its competitors and also breaches rules governing the aid states can provide to companies.

Apple employs about 5,500 people in Ireland, which amounts to about a quarter of its total European workforce. In 2014, when it opened the investigation into the Apple-Ireland tax deal, the European Commission accused Ireland of allowing Apple to dodge taxes in return for the company keeping the jobs in the country.

Both Apple and Ireland are expected to appeal the decision. While the process continues, Apple will likely have to deposit an amount in an escrow account. The figure mentioned by the commission is only an estimate, and the exact amount will be determined by Irish authorities based on a formula suggested by the commission. Irish tax officials are also the ones responsible for collecting the fine from Apple.

According to the Irish Times, the money will be treated as windfall gains and the Irish government “will be required to use it to pay down the national debt.”

Ireland has attracted foreign investment for decades for its low corporate tax regime. On the one hand, the U.S. has concerns about American companies using countries like Ireland for avoiding taxes. For instance, the iPhone maker holds $187 billion outside the country, based on its 2015 account books. On the other hand, however, the U.S. has also criticized EU tax officials for unfairly targeting American companies.

Shares of Apple were down 2.13 percent at 6:22 a.m. on Nasdaq before market opening Tuesday.