Copenhagen's "free city" of Christiania, a refuge for hippies, artists and activists, belongs to the state and not to squatters, a Copenhagen court ruled on Tuesday.
The ruling ends a legal challenge brought in November by squatters, who claim the enclave founded by hippies in 1971 is legally theirs.
Christiania is home to some 1,000 hippies, artists, activists and misfits. There are restaurants, cafes, shops and some unique-looking homes designed by residents and the area attracts more than a million visitors annually.
The Danish centre-right government wants however to clean up the area, build housing and open it up to the general public, a move Christiania dwellers have resisted.
The court ordered the "Christianites" to return to the negotiating table with Danish authorities to reach an agreement on opening up the enclave.
The court found "in favour of the state property board, the site belongs to the state," recalling that a 1978 Supreme Court ruling had declared that the Christiania dwellers had no special rights over the enclave.
Christiania was founded on September 26, 1971 when a band of guitar-laden hippies made an abandoned army barracks in central Copenhagen their home. They raised their "freedom flag" and named their new abode "Christiania, free city."
Its existence has been threatened since the arrival in power in 2001 of the Danish centre-right government, and it has been the scene of regular police raids and violent clashes, and even bloody settlings of scores between dealers.
In March 2004 police officially dismantled the hash market on Pusher Street, the site's most famed thoroughfare, estimating the soft drug market controlled by criminal biker gangs at one billion kroner (134 million euros, 174 million dollars) a year.
The same year, the Danish state terminated the enclave's user rights after residents refused to "normalise" Christiania and open it up to outsiders.
That decision infuriated Christiania residents and led to the legal challenge rejected by the Copenhagen court on Tuesday.