* Court to rule on legality of bans on diesel vehicles
* Retrofits could cost automakers billions of euros
* Similar bans looming in big cities in other countries (Adds quotes from judge, environmental group DUH)
LEIPZIG, Germany, Feb 22 (Reuters) - A German court has delayed a ruling on whether major cities can ban heavily polluting diesel cars, which could hit the resale value of up to 15 million vehicles in Europe's largest car market and force automakers to pay for costly modifications.
Judge Andreas Korbmacher said on Thursday the country's highest federal administrative court would rule on Feb. 27 on an appeal brought by German states against bans imposed by local courts in Stuttgart and Duesseldorf over poor air quality.
And he suggested the European Court of Justice might have to consider the issue of whether bans are permissible.
"We still see a considerable need for guidance," he said before breaking off the Leipzig court hearing.
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, bans in the birthplace of the modern automobile would be a new blow for the car industry, and an embarrassment for Chancellor Angela Merkel's government, which has backed it.
The Leipzig court is due to rule on whether bans imposed by local courts are legal after environmental group DUH sued city authorities. The DUH is also seeking bans in other German cities.
"Everything is still open, but we are much more optimistic," DUH chief Juerger Resch said after Thursday's proceedings, noting the judge had made clear that European pollution limits were non-negotiable and must be complied with quickly.
"We are convinced that the court will make its own decision. And we also want a national decision."
Germany has long promoted diesel to help cut carbon dioxide emissions and meet climate change goals, but the Volkswagen (VW) scandal has pushed its carmakers to step up spending on electric cars, as well as investments into making diesel engines cleaner.
During proceedings in Leipzig on Thursday, lawyers discussed whether the government would have to introduce a new way of labelling cars to enable authorities to enforce any bans.
Merkel's government, which has come under fire for its close ties to the car industry, has lobbied against bans, fearing they could anger millions of drivers and disrupt traffic in cities, with public transport not in a position to take up the slack.
Meanwhile, authorities in Paris, Madrid, Mexico City and Athens have said they plan to ban diesel vehicles from city centres by 2025, while the mayor of Copenhagen wants to ban new diesel cars from entering the city as soon as next year.
A small group of protesters from Greenpeace gathered outside the Leipzig court, with images of lungs painted on their chests and holding up signs reading "Clean Air Now".
"Because the government has failed to do anything for years about exhaust problems in the cities, judges have to decide today how residents will be protected from bad air," said Greenpeace transport spokesman Benjamin Stephan.
The threat of bans has prompted a big fall in sales of diesel cars in Germany, down to just a third of new car sales in January from almost half before the VW scandal.
"Diesel might get its final kiss of death (from the court ruling)," Evercore ISI analysts wrote in a note to clients.
In an attempt to avert bans, Merkel's government agreed a deal with carmakers last year to overhaul engine management software on 5.3 million diesel cars as well as funding for cities to help cut emissions by taxis and buses.
Environmental groups have called software updates insufficient and have lobbied for cars applying the latest Euro-6 and older Euro-5 emissions standards to have their exhaust treatment systems upgraded.
Evercore ISI has said it could cost up to 14.5 billion euros ($17.8 billion) to retrofit Germany's Euro-5 diesel fleet, and as much as double that if the entire diesel fleet is affected. ($1 = 0.8140 euros) (Reporting by Edward Taylor, Writing by Emma Thomasson; Editing by Keith Weir and Mark Potter)