* Planned retrofits of diesel cars not sufficient - judge
* Carmakers sought to avert legal curbs through retrofits
* Other cities could follow if Stuttgart bans diesel cars (Adds further details of ruling, background)
STUTTGART, Germany, July 28 (Reuters) - A German court backed a push to ban diesel cars from the city of Stuttgart, dealing a blow to carmakers Daimler and Volkswagen which had sought to avert legal curbs mainly by modifying emissions-control software.
Since Volkswagen admitted to cheating emissions tests almost two years ago, diesel cars have been the focus of scrutiny for their nitrogen oxide emissions that are blamed for causing respiratory disease.
Environmental group DUH went to court seeking a complete ban on diesel cars from Stuttgart, which said it would from next year bar diesel cars that failed to meet the latest emissions codes from the city on days with heavy pollution.
Stuttgart's home state of Baden-Wuerttemberg, which prefers measures that include improved public transport and retrofitting diesel cars to cut emissions, said it would study the ruling. It has not said if or when it would impose a complete ban.
Analysts have said they expected other major cities would follow swiftly if Stuttgart put a diesel ban in place.
"Safeguarding health is more important than the right to property and the general liberty of the car owners affected by the ban," Wolfgang Kern, the presiding judge at the Stuttgart administrative court, said in his ruling.
Stuttgart's pollution-fighting plan must provide for meeting emissions limits as soon as possible but planned retrofits of diesel cars are insufficient and would come too late, Kern said.
The mayors of Paris, Madrid, Mexico City and Athens have said they plan to ban diesel vehicles from city centers by 2025. The French and British governments have said they would end the sale of new gasoline and diesel vehicles by 2040.
This month, Sweden's Volvo became the first major traditional automaker to set a date for phasing out vehicles powered solely by the internal combustion engine by saying all its car models launched after 2019 would be electric or hybrids. (Reporting by Ilona Wissenbach; Writing by Andreas Cremer; Editing by Maria Sheahan and Edmund Blair)