A top German court has ruled in favour of allowing major cities to ban heavily polluting diesel cars, a move likely to hit the value of 12 million vehicles in Europe's largest car market and force car makers to pay for costly modifications.

There has been a global backlash against diesel-engine cars since Volkswagen admitted in 2015 to cheating US exhaust tests, meant to limit emissions of particulate matter and nitrogen oxide (NOx), known to cause respiratory disease.

While other countries are also considering restrictions on diesel cars, a ban in the birthplace of the modern car is a new blow for the car industry, and an embarrassment for Chancellor Angela Merkel’s government, which opposes bans.

Tuesday’s ruling by the country’s highest federal administrative court came after German states had appealed against bans imposed by local courts in Stuttgart and Duesseldorf in cases brought by environmental group DUH over poor air quality.

Merkel’s government, which has come under fire for its close ties to the car industry, had lobbied against a ban, fearing it could anger millions of drivers and disrupt traffic in cities, with public transport not in a position to take up the slack.

Although the ruling only directly affects Stuttgart and Duesseldorf, it could clear the way for other German cities to impose limits on diesel use.

Diesel power has become controversial ever since it emerged in 2015 that Volkswagen, and subsequently other car manufacturers, had doctored test results to downplay the emissions released by diesel-powered engines.