Germany's highest court said that a policy to freeze rents in Berlin for five years to combat soaring housing costs was unlawful in a ruling published today.

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

The tribunal ruled in favour of 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 not state jurisdiction.

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

It is a blow to them ahead of September elections both in Berlin - its own city-state - and for a new federal parliament and successor to Chancellor Angela Merkel who is stepping down.

Berlin has seen its housing costs double over the last decade as employees lured by a strong job market moved into the city.

The law capped rents until 2025, after which any increases would have been limited to 1.3% per year in line with inflation.

According to the city's department for urban development and housing, it affected more than 1.5 million apartments.

Exceptions included social housing and new apartments built since 2014.

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.

Those tenants will now generally be required to repay back rent.

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.

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

Only 18.4% of the city's roughly four million residents own their own property, one of the lowest rates in Europe.