The European Commission has slapped down what it describes as a cosy tax arrangement between Luxembourg and Amazon, and has ordered the online retailer to pay back €250m (£221m) in taxes.

In a highly embarrassing situation for Commission itself, the deal was inked in 2003, when its current president Jean-Claude Juncker was the Prime Minister of Luxembourg.

Following a three-year investigation, the EC said Amazon had been allowed to pay "substantially less tax than other businesses" by Luxembourg as a result of the arrangement, which is "illegal under EU state aid rules."

However, the tax demand of €250m is less than the €400m projection offered by the EC last year.

European Competition Commissioner Margrethe Vestager said: "Luxembourg gave illegal tax benefits to Amazon. As a result, almost three-quarters of Amazon's profits were not taxed."

Vestager added that the benefits meant that Amazon paid four times less tax than other local companies incorporated in Luxembourg.

"Member states cannot give selective tax benefits to multinational groups that are not available to others," she concluded.

Meanwhile, the EC also confirmed that it planned to take Ireland to court over its failure to collect €13bn of back taxes from Apple. The Irish government claimed the deal was fair and it would not be collecting the taxes, while Apple described the demand as ludicrous.

Juncker's office declined comment on the matter, while Amazon said it is studying the ruling. A spokesperson for the online retailer noted: "We believe that Amazon did not receive any special treatment from Luxembourg and that we paid tax in full accordance with both Luxembourg and international tax law.

"We will study the Commission's ruling and consider our legal options, including an appeal. Our 50,000 employees across Europe remain heads-down focused on serving our customers and the hundreds of thousands of small businesses who work with us."