Reading Borough Council and its neighbour West Berkshire District Council had sought to persuade the High Court to quash the planning guidance which exempts small development sites from the need to have affordable housing included on them.
The two councils claimed that the new policy, introduced in a ministerial statement last November, would drastically reduce the amount of affordable housing across the country by more than 20 per cent.
And they claimed that it would have a particular impact in their areas, as well as providing a windfall to landowners and developers.
On Friday they won the backing of one of the High Court in their fight to retain the need for affordable housing to be included on smaller sites.
Mr Justice Holgate quashed the policy, which excluded developments of ten homes or fewer, or 1,000 square metres or less, from the requirement to provide or contribute to affordable housing provision. In rural areas, a lower threshold of five homes would apply.
The judge ruled that the policy was "incompatible" with the statutory planning framework.
And, as a result of his decision he ordered that the government to pay the councils' £35,000 legal costs run up in bringing the case to court.
The authorities had argued that the policy would result in a loss of 21 per cent of affordable housing contributions across the country, but would have a particular impact in Reading, where tight restrictions on development including the green belt mean that a significant amount of new housing is built on brownfield sites, which often small ones, and would therefore fall within the exemption.
Reading claimed that the policy would result in a loss of up to 30 much-needed affordable homes per year in its area, out of a target of 167. And the more rural West Berkshire council said it would lose almost a quarter of its affordable housing under the policy.
The government has now removed paragraphs from a section on planning obligations in the national planning practice guidance related to the small development policy and the vacant building credit.
Alan Law, West Berkshire’s executive member for planning said: "The decision to legally challenge the government on this issue was not taken lightly. The judgement handed down today confirms that the council were fully justified in challenging this policy change in order to deliver much needed affordable housing and safeguard funding for critical infrastructure such as education.
"This was a concern for council and by joining with Reading it was demonstrated that this issue was a cross party concern. Our Core Strategy, fully endorsed by the government’s planning inspector at a comprehensive set of hearings in 2012, allowed us to seek an affordable housing contribution on sites of 5 dwellings or more."
A Department for Communities and Local Government spokesman said: "We’ve got Britain building and we’re determined to maintain this momentum, including by reducing the red tape and extra costs that prevent smaller developments from getting built.
"We are disappointed by the outcome of the judgement and will be seeking permission to appeal against the judge’s decision. This will have a disproportionate impact on smaller builders who are important in providing homes for local communities."
R on the Application of West Berkshire District Council v Department for Communities and Local Government. Case Number: CO/76/2015