Although the phase-out decision itself was legal, the judges said, the firms have a right to “appropriate” compensation from the government, which is not provided for in the law as it stands. The judges did not however specify how much the damages should be.
German electricity giants EON and RWE and Sweden's Vattenfall argued that the government-ordered shutdown of the country's nuclear plants amounts to an “expropriation” of their assets.
They asked the Constitutional Court in the southwestern city of Karlsruhe to award them some €20 billion in damages, according to media reports.
Chancellor Angela Merkel's government decided after Japan's 2011 Fukushima reactor meltdowns to halt operations of Germany's eight oldest nuclear plants and to shutter the other nine by 2022.
The move marked a sharp reversal for Merkel. She had earlier overturned a phase-out ordered by a previous government in 2002 and extended the lifespan of Germany's nuclear fleet until 2036.
The chief of Germany's biggest power company EON, Johannes Teyssen, told the court in March that while the companies respected the political choice to give up on nuclear energy, they should not have to foot the bill alone.
“We cannot simply accept that parliament disregarded constitutional requirements by providing for no compensation,” he said at the time.
“For our shareholders – including many small stock holders who have their savings and pensions invested with us – this creates a significant financial loss which under current law will not be compensated for.”
The firms have complained that the losses come at a time when they are already struggling in the face of low wholesale electricity prices and competition from heavily subsidised renewables as part of Germany's shift to clean energy such as wind, solar and biomass.
Critics however have countered that the big energy companies benefited from massive state subsidies when the nuclear plants first went into operation.
At the same court hearing in March, Environment Minister Barbara Hendricks defended the government's position, saying that the Fukushima catastrophe had “necessitated a reassessment of the risks associated with nuclear energy”.
Observers said the outcome of the case was difficult to predict, complicated by the fact that judges would also have to rule on whether Vattenfall's complaint was even admissible in a German court given that it is a Swedish company.
The verdict could have an impact on separate negotiations between the government and nuclear plant operators on managing the country's atomic waste disposal.
Under a draft law approved in October, the firms Vattenfall, EON, RWE and EnBW would have to contribute €23.5 billion to a state fund for the storage of nuclear waste by 2022.
The agreement is yet to be finalised however, and the plaintiffs may well use a favourable verdict as leverage in the talks.
Safely decommissioning all the plants and storing their radioactive parts and waste could cost up to 50 billion euros, experts estimate.
Eight nuclear power stations remain in operation in Germany today.