Further restrictions on diesel cars could be introduced after the UK government lost a legal battle over clean air.

Nitrogen dioxide in cities is illegally high and the European Court of Justice ruled judges must force ministers to clean up the air as soon as possible. The pollutant comes almost entirely from diesel vehicles.

The group that brought the case, ClientEarth, says the government now has no choice but to restrict diesel emissions.

They say that could force ministers to order a major retrofit of pollution controls on buses and lorries; ban diesel cars from cities; and install new technology to ensure that diesel cars comply with the emissions data from manufacturers.

Alan Andrews, ClientEarth lawyer, said: “This ruling is a big victory for the millions of people who want to live healthy lives in the UK’s towns and cities. This will force the government to finally take this issue seriously and come up with an urgent plan to rid our towns and cities of cancer-causing diesel fumes.

“The government has done next to nothing to try to achieve the target of cleaning up the pollution by 2015. The UK Supreme Court will now set a standard that the government must achieve – and that will mean the government driving down diesel emissions.”

A Defra spokesperson said: “Air quality has improved significantly in recent years and average roadside concentrations of NO2 levels have fallen 15% since 2010. We have built on this by committing £2bn since 2011 to increase the uptake of ultra-low emission vehicles, green transport initiatives and supporting local authorities to take action.

“The government is fully committed to ensuring compliance with EU air quality standards and we are revising our plans to reflect recent action so we can be compliant as soon as possible. This is a common challenge across Europe with 17 member states exceeding limits.

“This judgment confirms where limit values are exceeded, plans must be developed which ensure compliance in the shortest possible time – this has always been the government’s position.”