* Court ruled cities could ban heavily polluting cars
* Government accused of cosy ties with manufacturers
* Air quality concerns rise up agenda in Germany (Releads, adds details, background)
BERLIN, Feb 28 (Reuters) - Germany's government scrambled on Wednesday to find ways to avoid possible bans on heavily polluting diesel vehicles in cities, in a bid to reassure drivers and carmakers after a court ruled that local authorities were allowed to bar them.
Tuesday's ruling to allow city bans embarrassed Angela Merkel's government, criticised for having cozy ties with the auto industry which employs some 800,000 people, and raises pressure on manufacturers to make costly modifications to vehicles. 1/8nL8N1QH2L1
In Germany, a nation of drivers who expect to drive powerful cars in cities and on motorways with no speed limits, any restrictions will be unpopular. Yet air quality is also major concern, with green and consumer groups pushing for action.
Merkel's government is bending over backwards to play down the prospect of widespread bans which, manufacturers say, could cut the resale value of up to 15 million vehicles in Europe's biggest car market.
Bans could also herald the end of the combustion engine, which Germans pride themselves on inventing.
"This is a complicated topic. There are different situations in different cities," said government spokesman Steffen Seibert.
He said levels of nitrogen oxide (NOx) had fallen in recent years and many cities would not have to resort to bans. But he acknowledged solutions were needed for cities with significantly higher levels of NOx which can cause respiratory diseases.
"We expect that most cities with moderate overshoots will not have to resort to bans," he said.
Seibert said a new government under conservative Merkel would consider the option of introducing blue badges for heavily polluting vehicles nationwide, a step towards imposing some restrictions on their use in certain areas. Details of any such schemes have yet to be agreed.
Since Volkswagen in 2015 admitted to cheating U.S. emissions tests, German carmakers, also including Daimler and BMW, have faced a backlash against diesel technology, in which they have invested billions.
While gradually moving towards electric cars and committing to software changes for vehicles, critics accuse the government and carmakers of shying away from bigger steps such as phasing out diesel and more expensive technical modifications.
These would mostly involve adapting exhaust systems by adding or altering particle filters and cables.
France and Britain will ban new petrol and diesel cars by 2040.
One factor complicating any policymaking on a national basis is a difference in emphasis within the German government, which until now has been a coalition of Merkel's conservatives and the Social Democrats (SPD).
Merkel hopes to renew that coalition but needs the approval of SPD members. Results of a ballot on the deal will be announced on Sunday meaning a government could be in place during March.
Differences were evident on Wednesday when a spokesman for the transport ministry, run by conservatives, said hardware modifications to diesel cars could be very expensive and must bear some relation to the value of the vehicle.
Meanwhile, Justice and Consumer Affairs Minister Heiko Maas, of the SPD, said it was up to carmakers to respond.
"Drivers must not foot the bill for the failures of the auto industry," Maas told the Rheinische Post daily, adding software upgrades were insufficient."
Other measures floated include introducing free public transport in some cities. At the weekend, documents seen by Reuters showed the government was considering bans on certain routes on an emergency basis.
For a Factbox on consequences of German court ruling, click here: (Writing by Madeline Chambers Editing by Edmund Blair)