The European ⁠Parliament has voted to refer the European Union’s free trade agreement with South America to the bloc’s top court, a move that could delay the deal by ⁠two years and potentially derail ⁠it.

The European Union signed its ⁠largest-ever trade ⁠pact with Mercosur members Argentina, Brazil, Paraguay ⁠and Uruguay on Saturday.

The agreement still requires approval before it can take effect.

In a close ballot, MEPs voted 334 to 324 in favour of asking the Court of Justice of the European Union (CJEU) to determine whether the deal is compatible with the bloc’s policy.

The European Commission said it regrets the decision.

Minister of State at the Department of Agriculture Michael Healy Rae welcomed the decision to refer the trade agreement to the European courts.

“The vote this morning is very welcome,” as it allows “intensive canvassing to take place before the next vote,” he told the Dáil.

He challenged comments from Sinn Féin TD Martin Kenny that the Government was guilty of engaging in a “cute boyo routine”.

The Irish Farmers Association has said the move “lays down an important marker for how trade issues are negotiated”.

“The referral was the right decision for this trade deal and future trade deals. Farm organisations across Europe, as part of COPA, lobbied morning noon and night and it worked,” IFA President Francie Gorman said.

Opponents of the deal led by France – the EU’s largest agricultural producer – say the deal will sharply increase imports of cheap beef, sugar and poultry, undercutting domestic farmers who have staged repeated protests.

A group of 144 politicians lodged a legal challenge asking the EU Court of Justice ⁠to rule on whether the agreement can be applied before full ratification by all member states and whether its provisions ⁠restrict the EU’s ability to set environmental and consumer health policies.

The court typically takes around two years to deliver such opinions.

Ireland was one of five countries, including France, Austria, Hungary and Poland, to vote against the agreement.

Thousands of farmers have protested in each of those countries in recent weeks against the deal.

Together, the EU and Mercosur account for 30% of global GDP.

The treaty will eliminate tariffs on more than 90% of bilateral trade.

This will favour European exports of cars, wine, and cheese, while making it easier for South American beef, poultry, sugar, rice, honey, and soybeans to enter Europe.

Irish MEP Sean Kelly, who is part of the EPP group of Commission President Ursula von der Leyen, voted against the motion along party lines.

“I regret the outcome of today’s vote to refer the Mercosur trade deal to the ECJ for an opinion but I respect the decision of the majority of MEPs.

“My concern is that this approach, seeking ECJ opinions, undermines the decision-making power of the elected European Parliament. We now have to wait on the court to make its opinion known and the timeline is unclear.

The EPP spokesman on international trade, Jörgen Warborn, indicated in a post on Twitter that the deal will be enacted provisionally, meaning the trade deal will go info effect until the parliament votes, which could now take years.

Other Irish MEPs who voted for the motion including Billy Kelleher, Barry Cowan and Michael McNamara said they were happy with the result. When asked if, he was worried, that the EPP will push the deal through and he now may have to wait years to vote against it, Mr McNamara said: “The longer the better”.

Dublin MEP Aodhán Ó Ríordáin voted for the motion on legal grounds but said he’s now unsure whether to vote against the trade deal.

He said he was concerned about turning down an international trade deal given the volatile political situation over Greenland and said that a whole swathe of EU treaties may need to be renegotiated to deal with the changes in the world order put in motion by Donald Trump.

Additional reporting: Fergal Gallagher, Micheál Lehane