He said his job had been to determine the legal merits of Mr Dillner’s High Court action and added: “Nothing in my judgment is to be read as criticising the residents of Sheffield for seeking to protect the trees in their streets and roads whose presence many of them appreciate so much.”

The judge said Mr Dillner should pay £5,000 of the legal costs run up by the council – as well as footing his own lawyers’ bills.

Earlier this year, Mr Clegg had described the programme as a ‘national scandal’.

Mr Clegg said in February he had emailed council leader Julie Dore and told her: “When I helped to secure the £1.2 billion of government money to fix Sheffield’s roads, no-one expected that money to be used by Sheffield City Council to chop down hundreds of healthy mature roadside trees against the wishes of the public.

“This project was meant to be good news for Sheffield but under your watch this has become a national scandal.”

A Sheffield Council Labour group spokesman had responded by saying plans to replace trees were drawn up by the Lib Dems when they were in control in 2009.

Simon Green, executive director for place at Sheffield Council said: “We are pleased that the Council’s actions have been supported by this court ruling. What this programme has always been about has been upgrades to the city’s highways network, including protecting our tree stock for the long term ensuring we have decent roads and healthy trees for the future. We will now get on with the job of doing this.

“The judgement reinforces our legal duty to keep the highway in good repair, pointing out that failure to do so would inevitably result in injuries and legal claims

“The decision demonstrates that we have been right to say we are following best practice guidance and working hard in the best interests of the city. While the court is clear that the Councils current programme of consultation is sufficient, we remain committed to listening to the residents of the city.”