A judge rejected the councils' claim that the mayor's plans to close 10 fire stations were legally flawed for a number of reasons, including a failure to take into account the reality of increased fire risks in inner London.
Campaigners say the cuts, which involve the loss of more than 500 jobs and the axing of 14 engines, would be "reckless, wrong and will seriously endanger lives".
But Mr Justice Foskett ruled the process by which the closure decision was reached was lawful.
He said: "I appreciate that the outcome will come as a disappointment to a number of people who had hoped to see the proposed changes to the provision of fire services in their area set aside."
More top news
A rapist has been given three life sentences for a vicious attack on an 81-year-old woman minutes after he sat next to her on a bus.
When he was starting out Anthony Joshua accidentally broke his coach's wrist — and Sean Murphy still has the scars to prove it.
The verdict stemmed from ugly scenes which marred the Capital One third-round tie at Selhurst Park in September 2015.