The government has been defeated in the High Court over the way it scrapped part of England's school building programme.
The education secretary's decision to axe Buildings Schools for the Future (BSF) projects in six local authority areas was ruled unlawful as he failed to consult on it.
A judge ordered Education Secretary Michael Gove to reconsider the move.
The government said it had won the case on the substantive points.
Mr Justice Holman, sitting in London, allowed the challenges by the councils, declaring that Mr Gove had unlawfully failed to consult them before imposing the cuts.
The challenges related to the revamp or rebuild of 58 schools which, if allowed to go ahead, would have cost the government £1bn.
In five of the six council cases, the failure was "so unfair as to amount to an abuse of power", said the judge.
The councils - Waltham Forest, Luton Borough Council, Nottingham City Council, Sandwell, Kent County Council and Newham - had sought a judicial review on the grounds that the way projects had been stopped was arbitrary and legally flawed.
They asked the judge to order Mr Gove to reconsider the schemes, properly taking account of their merits.
The judge said: "However pressing the economic problems, there was no overriding public interest which precluded consultation or justifies the lack of any consultation."
Mr Gove's decision-making process was also unlawful "because of his failure to discharge relevant statutory equality duties under the Sex Discrimination Act, Race Relations Act and Disability Discrimination Act."