Apple and Ireland have won an appeal against an EU order that the tech giant pay the country €13bn (£11.6bn) in back taxes.
In 2016, the European Commission ruled that Ireland had breached state aid rules by giving Apple unfair tax benefits, and ordered Ireland to recover the money plus interest.
Both Ireland and Apple appealed that judgment and, on Wednesday, the General Court of the European Union annulled the European Commission decision.
In its decision, the General Court decreed that Apple had not been "granted a selective economic advantage" by Irish tax policies.
The Irish Department of Finance welcomed the ruling, saying: "Ireland has always been clear that there was no special treatment provided to [Apple]. The correct amount of Irish tax was charged, taxation in line with normal Irish taxation rules."
Apple thanked the General Court, saying "We are pleased they have annulled the Commission's case. This case was not about how much tax we pay, but where we are required to pay it. We're proud to be the largest taxpayer in the world."
The European Commission's executive vice president Margrethe Vestager said: "The Commission will continue to look at aggressive tax planning measures under EU state aid rules to assess whether they result in illegal state aid."
The ruling will be seen as an embarrassing blow to the Commission's efforts to impose tighter rules on US tech companies.
Last month, Ms Vestager said there was an "urgent" need for the EU to bring in its planned Digital Services Act to tighten regulations.
In Ireland, the decision is not universally popular either.
Reacting to the news, Sinn Fein finance spokesperson Pearse Doherty said: "Today was a bad day for the Irish taxpayer."
Another opposition TD (member of the Irish parliament) said it would constitute "economic treason" if the Irish government does not accept the money, against the backdrop of the fiscal slump caused by the coronavirus pandemic.
:: Listen to the Daily podcast on Apple Podcasts , Google Podcasts , Spotify , Spreaker
Apple had previously described the European decision as defying "reality and common sense", while the Irish government had said it was fundamentally flawed.
Ireland had always refused to pursue the funds, but in 2018, Apple put €14.3bn into an escrow - or holding - account, comprised of the €13.1bn in alleged unpaid taxes plus interest of €1.2bn.
The ruling could be appealed at the European Court of Justice.
Ms Vestager said: "We will carefully study the judgment and reflect on possible next steps."