Cardiff council's decision to designate land at Llanishen reservoir for nature conservation has been overturned by the High Court in London.
Reservoir owner Western Power Distribution (WPD) has been trying for more than nine years to build homes in the area.
Mr Justice Ouseley said the authority's decision led to a conflict of interest between leisure and conservation uses of the land.
The council says it intends to appeal.
The judge said of WPD: "It is engaged in a long-running planning battle with the council and Welsh ministers over its plans to develop Llanishen reservoir for uses including residential, sailing and areas of nature conservation."
John Steel QC, representing the company, said the designation brought into "inevitable conflict" two statutes.
The council had designated the land under the national Parks and Access to the Countryside Act 1949, which gave priority to nature conservation over public access and recreation.
But the Public Health Trust Act 1875 already imposed a statutory trust over the land, giving priority to public access and recreation.
Mr Steel argued that the conflict was evident from the way in which the council intended to manage the reserve, which has a wide array of wildlife.
Mr Justice Ouseley agreed and quashed designation decisions taken by the council in October 2009 and October 2010.
He declared that land to be managed in the interests of nature conservation must not be compromised by it also being used for people's leisure pursuits.
The judge said conflicts of interest were not inevitable in all such cases, but it had clearly arisen in the case and it could not lawfully be resolved.
"The council's intentions, however laudable, show that it cannot square the circle and in reality does not intend to, however much it might wish and hope that it could," he said.
There has been a decade-long campaign to protect the former reservoir from development.
Although no longer in active use it has been seen as a beauty spot and nature haven in the city.
Cardiff council leader Rodney Berman said: "This is a deeply disappointing ruling but we're not just going to leave it at that.
"Cardiff Council has applied for permission to appeal against the decision."