When the EU’s top court gave its landmark ruling this week on a “sweetheart” tax arrangement with the world’s biggest company, the outcome had a surreal tinge: the winner wept and the loser pocketed €13bn.

Margrethe Vestager, the EU competition chief, had waged a bitter, decade-long battle to curb Ireland’s controversial tax breaks for Apple and on Tuesday the European court of justice (ECJ) gave her a resounding victory. “I was ready to face the loss, but it was the win that made me cry,” she said.

The court ruled that the European Commission was right to demand in 2016 that €13bn (£11bn) in “illegal” tax breaks for Apple should be repaid because it gave the iPhone-maker an unfair advantage.

The 80-page judgment from Brussels left the Irish government with a massive windfall equivalent to about 14% of total annual public spending – revenue it did not want and had fought desperately to avoid, a paradox not even Jonathan Swift could have conjured.

“Ireland loses a court case and gains €13bn as a result. Like Isaac Newton, I think I might need to sit under a tree and contemplate that one for a while,” said a letter to the Irish Times.

Apple, for its part, expressed dismay, experienced a minor blip – shares fell 0.5% on Tuesday – and sailed on with its valuation of $3.39tn (£2.6tn).

The ruling will be scrutinised in corporate headquarters, government offices and tax justice campaigners around the world for possible knock-on effects on other multinationals and taxation systems.

The stakes are especially high for Ireland which relies on corporate tax receipts from a handful of multinationals to bankroll government spending and budget surpluses. It had been willing to forfeit the $13bn to underpin this system. While shoring up its appeal to tech and pharma giants Dublin must now also figure out what to do with a tainted bonanza that has prompted recrimination, embarrassment and excitement.

The arrangement at the heart of this week’s ruling, the so-called “Double Irish”, was scrapped by Ireland under pressure from the EU in 2014. However, it was gradually phased out for other users of the loophole such as Google and Facebook’s parent company Meta and did not close finally until 2020.

The arrangement was characteristic of complex corporate structures that have raised the hackles of regulators and tax campaigners in recent decades, as multinationals took advantage of a tax version of beggar thy neighbour operated by states such as Ireland. Under the structure struck down by the EU, a multinational funnelled untaxed revenues to an Irish subsidiary which then paid the money to another company registered in Ireland but taxed elsewhere – hence “double Irish” – for example in the tax haven Bermuda.

However, the Apple ruling addresses a different era. Experts say the tax environment for big tech companies and other multinationals has changed in recent years, including in Ireland.

The Organisation for Economic Co-operation and Development, a Paris-based policymaking body whose members include the world’s largest economies, has been at the forefront of a drive to reshape the global tax framework which includes the introduction of a minimum corporate tax rate of 15% on large multinationals.

This means Ireland has dropped its cornerstone tax policy of a 12.5% tax rate for large companies such as Apple, Google, IBM, Microsoft and Meta that have significant operations in the country. The 12.5% rate will continue to apply to smaller companies in Ireland.

The Apple ruling is “very much a historic issue”, says Robert Dever, a Dublin-based tax partner at law firm Pinsent Masons. Dever says the situation in Ireland, which has been viewed as a tax haven for tech firms, has changed significantly. As well as ending the double Irish tactic and introducing a 15% rate, Ireland has enacted the EU’s anti tax-avoidance directive and tightened rules on transfer pricing – a technique used by multinationals to move profits between countries.

skip past newsletter promotion

Nonetheless, says Dever, the ECJ ruling is an embarrassment given that it stated Ireland had granted Apple unlawful state aid. “The fact that Ireland has been found to have provided state aid illegally, that causes reputational damage.” So did the naming of Irish companies and individuals in the Panama Papers, the 2016 investigation based on files leaked from the huge offshore law firm Mossack Fonseca.

Nevertheless, Dever says Ireland remains attractive to Silicon Valley and other multinationals due to a tax regime that still appeals in other areas, such as tax breaks for research and development. They are also drawn by some of the country’s embedded strengths: having a skilled workforce, a strong legal system, being English-language speaking, and an EU member.

Tax, though, is now a less effective tool for countries such as Ireland and Luxembourg that have wooed multinationals to boost their economies, as exemplified by the global minimum tax rate, part of a set of rules known as Pillar Two. The EU and UK were among the first wave adopting the changes at the start of this year, but the US and China have yet to implement them.

“The rules that are coming in are about creating a more level playing field and not having countries that can buy investment by having such low tax rates,” says Michelle Sloane, a tax partner at law firm RPC. “Things have moved on a lot since the Apple case.”

Even so, the Irish government has squirmed over its doomed effort to let Apple keep the €13bn.

“If we weren’t to stand up and defend our policy we would be giving out a message of uncertainty and instability,” Niall Collins, a junior minister, told RTÉ radio. The presenter zinged back: “You were right to challenge a situation where you gave Apple a deal that reduced its tax burden to as low as 0.005% in 2014?”

As it enters an election cycle the ruling centre-right coalition faces competing pressures over what to do with the bounty. Some urge a splurge on housing and infrastructure, others nominate education and poverty alleviation. A few say it should be funnelled into sovereign wealth funds or used to pay down the national debt. The taoiseach, Simon Harris, said the government would reflect “for a brief period” before deciding.

One suggestion, made in jest, would cost nothing: declare a new public holiday called Apple Windfall Day.