Germany's highest court said Thursday that a policy to freeze rents in Berlin for five years to combat soaring housing costs was unlawful, in a ruling slammed by tenants' rights groups.

The capital's "Mietendeckel" law or rent cap "violates the Basic Law and is thus ruled void", said the Federal Constitutional Court in the southwestern city of Karlsruhe.

The tribunal ruled in favour of 284 MPs from the centre-right Christian Democratic Union (CDU) and the pro-business Free Democrats, who are both in opposition in Berlin.

The court agreed with their argument that rent policy falls under federal law and not the jurisdiction of Germany's 16 states.

The rent freeze for more than 1.5 million apartments, passed by Berlin's legislature in January 2020, was a flagship policy of the governing coalition of the centre-left Social Democrats, the Greens and the far-left Linke parties.

The court decision is a major setback for them ahead of September elections both in Berlin -- its own city-state -- and for a new federal parliament and chancellor after Angela Merkel steps down this year.

The president of the German Tenants' Association, Lukas Siebenkotten, blasted the ruling as "bitter", calling it a "loud wake-up call to federal lawmakers to finally take action and stop the rent explosion in many German cities".

The chairman of Berlin's CDU party chapter, Kai Wegner, welcomed the announcement, saying the local government had "misled tenants with the false rent cap promise" while the FDP called for a "rent-decreasing building offensive".

The SPD, which is also the junior partner in Merkel's federal coalition, has pledged to champion rent controls nationwide in its election campaign.

Berlin was the first and only of Germany's states to introduce a rent cap.

The law froze rents at the level from June 2019 until 2025, after which any increases would have been limited to 1.3 percent per year in line with inflation.

Exceptions included social housing and new housing built since 2014.

The highest court's ruling to throw out Berlin's rent cap is a blow to millions of tenants
The highest court's ruling to throw out Berlin's rent cap is a blow to millions of tenants AFP / John MACDOUGALL

Some particularly high rents were even temporarily lowered, pending the court ruling, with landlords who broke the rules facing fines of up to 500,000 euros ($599,000).

Those tenants will now generally be required to repay back rent. A poll by Sparkasse public savings bank for the daily Tagesspiegel Thursday said that fewer than half of Berliners had set money aside for the arrears now due.

However at least one major housing company, Vonovia, said it would not require its tenants to repay the difference, warning that the ruling could stoke tensions with landlords.

Once described by a former mayor as "poor, but sexy", Berlin has seen housing costs double over the last decade as employees lured by a strong job market moved into the city.

The rent cap faced fierce opposition from the property sector, which argued that the freeze discouraged developers from building in Berlin and ultimately worsened the capital's housing crisis.

The policy also saw the number of rental offers plummet as owners declined to put apartments on the market, according to the German Institute for Economic Research (DIW).

According to the property website Immowelt, Berliners spend an average of one-quarter of their income on housing costs.

Only 18.4 percent of the city's 3.6 million residents own their own property, one of the lowest rates in Europe, with housing insecurity compounded by the pandemic.

"The coronavirus crisis is going to lead to a real social emergency when it comes to housing," warned tenant association Berliner Mietverein in February.

Unemployment rose to 10.6 percent in Berlin in 2020, a two-point rise on the previous year and almost five percentage points above the national average.

With tensions escalating in 2019 over rising rents, the debt-mired city government spent almost one billion euros to buy back 6,000 former public housing apartments that had been privatised.

Federal finance minister Olaf Scholz, the SPD's chancellor candidate, in February declared housing "one of the biggest social issues of our time".