BRUSSELS (Reuters) - Germany defeated its key EU ally France in a very tight vote on Monday to clear the use of weed-killer glyphosate for the next five years after a heated debate over whether it causes cancer.

After months of indecisive votes among the 28 member states in Brussels, Germany, whose Chancellor Angela Merkel has yet to form a new coalition after a September election, came off the fence after abstaining in previous meetings. It said it backed a European Commission proposal against the wishes of France.

The Commission, the European Union’s executive, said in a statement that 18 countries had backed its proposal to renew the chemical’s licence. Nine countries were against and one abstained, giving a “positive opinion” by the narrowest possible margin under rules requiring more than a simple majority.

The extension was opposed by Germany’s centre-left Social Democrats (SPD), with which Merkel is expected to launch exploratory talks this week on renewing their “grand coalition” after plans for an alliance with two other parties failed.

French President Emmanuel Macron, who was elected in May on a platform of pursuing deeper EU integration alongside Germany, had wanted a shorter extension and a rapid phasing out of glyphosate, which is a mainstay of farming across the continent.

After the vote, he said he would take all necessary measures to ban the product, originally developed by Monsanto MON.N, as soon as an alternative is available and at the latest within three years. Monsanto declined to comment.

Europe has been wrestling for the past two years over what to do with the chemical, a key ingredient in Monsanto’s top-selling Roundup, whose licence was set to expire on Dec. 15.

Slideshow ( 5 images )

The chemical has been used by farmers for more than 40 years, but its safety was cast into doubt when a World Health Organization agency, the International Agency for Research on Cancer (IARC), concluded in 2015 it probably causes cancer.

The European Union agreed to roll over the licence for 18 months pending the results of a study by the European Chemicals Agency, which said in March this year that there was no evidence linking glyphosate to cancer in humans.

Protest groups, however, seized on the IARC report, questioned the science in other studies and complained about the influence of big business.

“The people who are supposed to protect us from dangerous pesticides have failed to do their jobs and betrayed the trust Europeans place in them,” Greenpeace said after Monday’s vote.

In theory, the Commission could have pushed through a licence extension, but it said it wanted governments to make the call on an issue that has become so politically charged. After a series of indecisive votes, they finally produced a clear majority in favour of the Commission’s proposal.

“Today’s vote shows that when we all want to, we are able to share and accept our collective responsibility in decision making,” said health and food safety commissioner Vytenis Andriukaitis.

Slideshow ( 5 images )

Farmers association Copa-Cogeca said it was glad a decision had been taken, but regretted the licence renewal had not been for 15 years given strong scientific evidence from EU agencies.

The key swing vote came from Germany, whose government is operating in an acting capacity following the indecisive election. Berlin abstained earlier, but threw its weight behind a decision opposed by France.

Poland, Bulgaria and Romania, all did likewise, leaving only Portugal still on the fence on Monday. Had any of the others continued to abstain, deadlock would have gone on. An extension required 16 states representing 65 percent of the EU population to vote in favour. The 18 supporters account for 65.7 percent.

The German vote exposed internal divisions in Berlin ahead of this week’s coalition talks. Environment Minister Barbara Hendricks, an SPD lawmaker, accused the chancellor’s centre-right group of reneging on a deal to continue abstaining.

French Agriculture Minister Stephane Travert told reporters that Paris would push to change farming practices that embraced alternatives to glyphosate, so that its use could be ended.