The ban forms part of the UK Plan for Tackling Roadside Nitrogen Dioxide Concentrations, the government's £3 billion vision for improving the nation's air quality.
The document, published today, says the aim is to ban the sale of all diesel and petrol vehicles from 2040, in an effort to make "almost every car and van on the roads" zero-emission by 2050.
France made a similar pledge earlier this month, and has also set a deadline of 2040.
The UK's plan includes an investment of £600 million in the development, manufacture and use of zero-emissions vehicles by 2020, including £100 million towards building and retrofitting low-emission buses.
"The shift to ultra-low and zero-emission vehicles is well under way, and will continue to gather pace over the coming years as we move towards 2040, by which point the government will end the sale of all new conventional petrol and diesel cars," reads the document.
"This shift will resolve our air-quality problem as combustion engines gradually disappear from the streets of our towns and cities, some as soon as the early 2020s."
An earlier version of the document was released in May, but judges ordered it to be revised because it failed to meet EU pollution limits.
At the time, the government was criticised for having a "weak" strategy for cleaning up the UK's air – even though air pollution is thought to be the cause of up to 40,000 premature deaths a year in the country.
The new plan has also been met with criticism from both politicians and campaigners, with some saying the proposed ban on petrol and diesel cars is not enough to combat the problem.
In a tweet, former Labour Party leader Ed Miliband described the ban as a "smokescreen for weak measures to tackle 40,000 deaths a year from air pollution," while Green Party co-leader Caroline Lucas said there needed to be a more urgent plan.
The UK and France aren't the only countries that are moving towards a petrol-free future.
The Netherlands and Norway both previously said they wanted to get rid of petrol and diesel vehicles by 2025, while Germany has moved to ban petrol-powered cars from sale by 2030, providing a window into potential future regulations across the European Union.
Image courtesy of Freestock.