LONDON — Scrambling to combat a growing air pollution crisis, Britain announced on Wednesday that sales of new diesel and gas cars would reach the end of the road by 2040, the latest step in Europe’s battle against the damaging environmental impact of the internal combustion engine.

Britain’s plans match a similar pledge made this month by France, and are part of a growing global push to curb emissions and fight climate change by promoting electric cars. Carmakers are also adjusting, with Volvo notably saying recently that it would phase out the internal combustion engine in coming years and BMW deciding to build an electric version of its popular Mini car in Britain.

But the shift to electric vehicles will be a gradual one, and the target set by Britain is less ambitious than efforts elsewhere. President Trump’s decision to withdraw the United States from the Paris climate accord has also dented optimism.

Britain’s new clean air strategy, published on Wednesday, calls for sales of new gas and diesel cars and vans to end by 2040. The government will also make more than 200 million pounds, or $260 million, available for local governments to take short-term action, such as retrofitting buses, to reduce air pollution.