Seven London councils have lost their High Court battle over Boris Johnson's proposals to shut 10 fire stations in the capital.
More than 500 firefighters' jobs will be lost under the plans, which have been approved by the London Fire and Emergency Planning Authority (LFEPA).
The seven councils argued the plans are "legally flawed" and "could put lives at risk".
But the London mayor said "we need to continue to modernise the service".
Tower Hamlets, Camden, Greenwich, Hackney, Islington, Lewisham and Southwark councils were appealing against the cuts, which are expected to save £28.8m.
'Blood on hands'
The councils argued the mayor's decision "ignores the fire risks posed by a concentration of potential terrorist targets, tourist attractions, social and student housing and high-rise buildings in the affected boroughs".
Mr Justice Foskett, sitting at London's High Court, ruled the process by which the closure decision was reached was lawful.
"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," he said.
Following the decision, London Assembly Labour member Fiona Twycross said she was "deeply disappointed".
The Fire Brigades' Union said Mr Johnson would have "blood on his hands" if he went ahead with the cuts.
The union pointed out that three out of the eight fire stations, which sent engines to the Apollo Theatre ceiling collapse in London's West End on Thursday, are among the 10 stations due to close in 20 days.
Mr Johnson said: "I am pleased that the court has recognised the robustness of LFEPA's plans.
"I hope that all the parties involved will now draw a line under this and help us move forward and work with the Fire Commissioner to deliver a stable and secure future for the brigade."