The UK government has spent more than half a million pounds on failed legal battles against clean air campaigners, according to newly released documents that underline the cost of weak action on pollution.

The figures – obtained under a freedom of information request by the Labour party – show repeated court defeats are hurting taxpayers in addition to the growing health impact of air pollution, which kills as many as 40,000 people a year.

In February, the environmental law organisation ClientEarth successfully challenged the government’s efforts to deal with roadside nitrogen dioxide. The government incurred costs of £148,135 and was ordered to pay ClientEarth’s costs up to £35,000, the documents show. The judge ruled the government’s 2017 air quality plan so poor as to be unlawful.

This was the third case against ClientEarth in less than 12 months. In a ruling last July, the government incurred £60,582 in costs. Last April, it ran up a court bill of £14,796 and was ordered to pay the environment group’s costs of £11,000.

In parliamentary questions last June, the government revealed it had already spent £310,000 in court battles against ClientEarth.

With the total now more than £500,000, the Labour party accused the government of squandering money and time in dealing with the pollution crisis.

“This Tory government has had to be dragged through the courts every step of the way and have wasted hundreds of thousands of taxpayers’ money fighting losing cases instead of taking action,” shadow environment secretary Sue Hayman said.

ClientEarth echoed the criticism of the government. “Its decision to fight ClientEarth in court rather than cleaning up our air is baffling, and it is now eight years late to meet legal pollution limits,” said the group’s chief executive, James Thornton. “The government’s continued failure to act on air pollution damages people’s health and puts lives at risk across the UK. It’s time to quit these costly delays and start cleaning up our air.”

The Department for Environment, Food and Rural Affairs defended the legal costs, noting that the government had a partial success in the most recent case.

“We have already delivered significant improvements in air quality since 2010 and it was right to defend our position in court. The judge dismissed two of the three complaints in the latest case and found that our approach to areas with major air quality problems is ‘sensible, rational and lawful’,” said a Defra spokesperson.

“We will continue to implement our £3.5bn plan and work with local authorities to reduce emissions and improve air quality.”