A judge at the High Court in London ruled in favour of environmental lawyers ClientEarth in the judicial review.
The group called air pollution a ‘public health crisis’ and said the government has failed to tackle it.
The ruling called the government’s plan ‘woefully inadequate’.
The Department for Environment, Food and Rural Affairs (Defra) said it accepted the court’s judgment.
ClientEarth won a separate, Supreme Court ruling against the government in April 2015.
That judgment ordered ministers to come up with a plan to bring down air pollution to within legal limits as soon as possible.
But ClientEarth was dissatisfied with those proposals, and took the government to the High Court in a judicial review.
In the ruling, Mr Justice Garnham said the 2015 Air Quality Plan (AQP), devised when Liz Truss was environment secretary, failed to comply with the Supreme Court judgment and EU directives.
Furthermore, the ruling said the government had erred in law by fixing compliance dates based on over-optimistic modelling of pollution levels.
‘It seems to me plain that by the time the plan was introduced the assumptions underlying the secretary of state’s assessment of the extent of likely future non-compliance had already been shown to be markedly optimistic,’ said Mr Justice Garnham.
He said the secretary of state ‘fell into error’ by fixing on a projected compliance date of 2020 (and 2025 for London) and also erred by ‘adopting too optimistic a model for future emissions’.
A spokesperson for Defra said its plans had always followed the best available evidence, adding: ‘Whilst our huge investment in green transport initiatives and plans to introduce Clean Air Zones around the country will help tackle this problem, we accept the court’s judgment.
‘We will now carefully consider this ruling, and our next steps, in detail.’