LONDON — In one of her final acts as prime minister, Theresa May pledged Wednesday to pass legislation that will commit Britain to eliminating its contribution to climate change by 2050, making it the first Group of Seven advanced economies to do so.

“This country led the world in innovation during the Industrial Revolution, and now we must lead the world to a cleaner, greener form of growth,” May said.

Environmental groups welcomed the announcement but raised concerns about how, exactly, Britain plans to reach net zero greenhouse has emissions by 2050. Others said the target was not ambitious enough or would be impossible to achieve.

Major protests in Britain, including by children skipping school to march through cities, have helped push climate change toward the top of the political agenda.

An activist group called Extinction Rebellion has also organized several high-profile protests, leading to more than 1,000 arrests. One of its demonstrations included a “die-in” at the Natural History Museum, where hundreds of demonstrators lay down in a hall beneath a blue whale skeleton to raise awareness of predicted mass-extinction events caused by humans. 

May is keen to cement a legacy beyond Brexit in her final weeks as prime minister. She resigned as party leader Friday and will officially step down as head of government once her successor is picked, mostly likely in late July. 

 “It’s clear this is a legacy issue, and it really is a tremendous legacy for her to leave behind,” said Bob Ward, policy director for the London-based Grantham Research Institute on Climate Change and the Environment. 

Britain has demonstrated that it knows how to rapidly decarbonize its energy mix. Ward said that since 1990, the country reduced its greenhouse gas emissions by 44 percent while its economy grew by more than 75 percent.

One of the main factors is the phasing out of coal. Last month, Britain went for two weeks without using coal to generate power, the first time it’s done so since the late 19th century.

But achieving the new target would require profound change — the current policy is to reduce emissions by 80 percent by 2050. Philip Hammond, the finance secretary, said that meeting the more ambitious goal could cost 1 trillion pounds, leaving less money for public services such as schools and hospitals, according to a letter leaked to the Financial Times.

The new law highlights the stark contrast between the British and U.S. administrations over their approaches to climate change. Speaking alongside President Trump at their joint news conference last week, May said that in their talks she “set out the U.K.’s approach to tackling climate change and our continued support for the Paris agreement.” 

Trump has previously called climate change a “hoax” and initiated U.S. withdrawal from the Paris climate accord. He told Britain’s ITV broadcaster last week that when pressed on the issue by Prince Charles, he responded that “the United States right now has among the cleanest climates.” 

Other countries have set similar carbon-neutral goals, including some Scandinavian nations. But Britain is the first “major economy” to make such pledges, according to the government. France is also looking at putting similar targets on a statutory footing

Analysts said the British legislation could go through within a week or so, because it can be done through an amendment to the 2008 Climate Change Act. 

Extinction Rebellion UK tweeted that global warming, feedback loops, biodiversity loss and habitat destruction “will most likely kill us all well before then. 2050 is just business as usual with a suicidal twist. Strange that we have to fight for our lives.”

Greenpeace UK said it was a “big moment” in the fight against climate change, but the group also worried that Britain would achieve its goal partly through international carbon credits, shifting the burden to developing nations.

Doug Parr, chief scientist for Greenpeace UK, said in a statement: “This type of offsetting has a history of failure and is not, according the government’s climate advisers, cost efficient.”

The decision “fires the starting gun for a fundamental transformation of our economy,” Parr said. “The government must immediately upgrade our electricity, construction, heating, agriculture and transport systems. They must cancel the Heathrow 3rd runway and road-building plans, and invest public money and provide significant policy support to protect communities, workers and the planet.”

Several of the politicians seeking to replace May have come out with strong positions on tackling climate change. Boris Johnson, the current favorite, has written several newspaper articles in support of the environment. 

Ward, the climate change expert, doubted that any of the candidates to be the next prime minister would speak out against the target, not least because it’s an important issue for younger voters. 

“It’s not about whether we should get to the 2050 target,” he said. “It will be a discussion about the best way of doing it.”