The European Union voted on Monday to extend its authorization for the world’s best-selling herbicide for an abbreviated period of five years, with France and Germany splitting over the move.

President Emmanuel Macron of France said after the decision was announced that he had asked government officials to draw up a plan for banning the herbicide, glyphosate, in his country within three years. He also posted a message on Twitter with the hashtag #MakeOurPlanetGreatAgain. France led the opposition to allowing the use of glyphosate, the main ingredient in Monsanto’s Roundup and in weed killers made by other companies.

Germany, which had abstained in a previous round of voting on the issue, appeared to help sway the outcome of the vote. Although Angela Merkel, the chancellor, has been unable to form a coalition government after the country’s recent election, Germany’s caretaker government swung its support in favor of the weed killer.

The decision appeared to be contentious even within the caretaker government. A split between ministers was reported by Der Spiegel, with Germany’s environment minister, Barbara Hendricks, a member of the Social Democrats, expressing opposition to glyphosate and blaming Ms. Merkel’s conservative Christian Democrats for the decision. The two parties are in the process of negotiating over potentially creating a new coalition.