* Court rules that city bans possible even without national rules
* Shares of automakers under pressure
* Decision could reduce value of diesel cars (Updates with court ruling)
LEIPZIG, Germany, Feb 27 (Reuters) - A top German court ruled on Tuesday in favor of allowing major cities to ban the most heavily polluting diesel cars, a move set to hit the value of 12 million vehicles in Europe's largest car market and probably force carmakers to pay for costly modifications.
There has been a global backlash against diesel-engine cars since Volkswagen admitted in 2015 to cheating U.S. 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 automobile is a new blow for the car industry, and an embarrassment for Chancellor Angela Merkel's government.
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.
The 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.
The court on Tuesday rejected the appeals by the state governments and ordered Stuttgart and Duesseldorf to amend their anti-pollution plans, saying that city bans can be implemented even without nationwide rules.
"This is a great day for clean air in Germany," DUH managing director Juergen Resch said.
DIESEL CAR SALES DECLINE
The shares of German automakers Volkswagen, Daimler and BMW slipped after the ruling, trading down 1.7 percent, 0.4 percent and 0.8 percent respectively.
The environmental lobby DUH sued Stuttgart and Duesseldorf to force them to implement driving bans, after about 70 German cities were found to exceed European Union NOx limits.
Sales of diesel cars have been falling fast in Europe since the Volkswagen scandal, with fears of driving bans sending demand sharply down in Germany in the last year.
Paris, Madrid, Mexico City and Athens have said they plan to ban diesel vehicles from city centers by 2025, while the mayor of Copenhagen wants to ban new diesel cars from entering the city as soon as next year.
The share of diesel cars in overall vehicle production in Europe could be cut to 27 percent by 2025 from 52 percent in 2015, Barclays forecasts.
Germany's government and the auto industry have been seeking to avert driving bans. Carmakers have pledged to overhaul software on 5.3 million diesel cars and are offering trade-in incentives for older models to help improve air quality.
But environmental groups have lobbied for costly improvements to exhaust cleaning systems for cars with Euro-6 and Euro-5 emissions standards.
"Once it is clear there will be driving bans the car industry will end its resistance against technical upgrades," DUH's Resch earlier told public broadcaster Bayern 2.
The government has begun work on legal changes to permit driving bans on certain routes on an emergency basis, transport ministry documents seen by Reuters showed.
It is also considering making public transport free in cities suffering from poor air quality.
Cities will probably target models with older emission controls. Of the 15 million diesel cars on Germany's roads, only 2.7 million have the latest Euro-6 technology, data by the KBA motor vehicle watchdog showed.
Retrofits would cost billions of euros and an outright ban could slash resale prices, which are used to price leasing and finance contracts. German auto safety group ADAC said carmakers should bear any costs of upgrading old diesel models. ($1 = 0.8106 euros) (Additional reporting by Christoph Steitz and Andreas Cremer Editing by Alexander Smith and Keith Weir)