* Court rules that city bans possible even without national rules
* Ruling is an embarrassment for Merkel's government
* Ministers say ban can still be averted
* Decision could cut value of diesel cars (Adds reaction)
LEIPZIG, Germany, Feb 27 (Reuters) - German cities can ban the most heavily polluting diesel cars from their streets, a court ruled on Tuesday, a move likely to accelerate a shift away from the combustion engine and force manufacturers to pay to improve exhaust systems.
The court said Stuttgart, which styles itself the birthplace of the modern automobile and is home to Mercedes-maker Daimler, should consider gradually imposing a year-round ban for older diesel models, while Duesseldorf should also think about curbs.
Many other German cities exceed European Union limits on nitrogen oxide (NOx), known to cause respiratory disease. Just hours after the ruling, the northern city of Hamburg said it would start to implement limits on diesel vehicles from the end of April.
There has been a global backlash against diesel-engine cars since leading German carmaker Volkswagen admitted in 2015 to cheating U.S. exhaust tests. The scandal has spread across the industry and prompted steps to promote the use of cleaner, electric vehicles.
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. France and Britain will ban new petrol and diesel cars by 2040.
The ban in the home of some of the world's biggest automakers is a further blow for the sector, and an embarrassment for Chancellor Angela Merkel's government, which has faced criticism for its close ties to the industry.
Germany has long promoted diesel to help cut carbon dioxide emissions and meet climate change goals, but the country now fears that a shift away from the combustion engine could threaten hundreds of thousands of jobs at carmakers and their suppliers.
The ruling was praised by environmental groups but angered many politicians and business lobbies who said millions of drivers might end up unable to use or sell vehicles they bought in good faith.
"Driving bans have a massive impact on our ownership rights, on mobility and on our profession," said Hans Peter Wollseifer, president of the association of German tradesmen. "The carmakers are to blame for the diesel problem, not us tradesmen."
Merkel said the government would discuss with regions and municipalities how to proceed, while her ministers said they still hoped bans could be averted by steps to bolster public transport and get automakers to improve emissions systems.
"We must do everything possible to prevent the loss of personal freedom and the reduction in value of cars," Transport Minister Christian Schmidt told a news conference.
Sales of diesel cars have been falling fast in Europe since the Volkswagen scandal, with fears of driving bans sending demand sharply lower in Germany in the last year.
Germany's VDA auto industry lobby noted the court had not insisted on driving bans: "It is a rejection of general driving bans... They must be proportional and only considered as a last resort," the VDA's Matthias Wissmann said in a statement.
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.
"This is a great day for clean air in Germany," DUH managing director Juergen Resch said.
"This is a debacle for the policies of the grand coalition, which has sided with the auto industry," Resch added, referring to the ruling coalition of conservatives and Social Democrats that Merkel hopes to renew in the coming weeks.
The court on Tuesday ordered Stuttgart and Duesseldorf to amend their anti-pollution plans, saying that city bans can be implemented even without nationwide rules.
"Cities in Germany feel abandoned by the federal government," Stuttgart mayor Fritz Kuhn told a news conference, adding the regional government would probably agree a new plan within six months.
The court said cars which meet Euro-5 emissions standards should not be banned from Stuttgart until Sept. 1, 2019, four years after the introduction of the latest Euro-6 standard. Tradesmen and some residents should be exempted, it added.
Environment Minister Barbara Hendricks said bans could still be avoided if automakers agree to pay to upgrade the exhaust cleaning systems of older diesels.
"The problem was caused by carmakers and we should not release them from their responsibility," she said.
Of the 15 million diesel cars on Germany's roads, only 2.7 million have Euro-6 technology. Evercore ISI has estimated that upgrading the exhaust cleaning of just the Euro-5 fleet could cost up to 14.5 billion euros ($17.9 billion).
"This is a groundbreaking ruling, and one which we expect has set a strong precedent for similar action across Europe," analysts at Evercore ISI said.
An outright ban could also slash resale prices, which are used to price leasing and finance contracts.
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. ($1 = 0.8118 euros) (Additional reporting by Andreas Cremer, Maria Sheahan and Tom Sims; Writing by Emma Thomasson; Editing by Keith Weir)