In a judgment with important ramifications for the art market, Mr Justice Moses said the law had to favour the true owner of stolen property - however long had elapsed since the original theft.
The Holy Family with Saints John and Elizabeth and Angels, by Joachim Wtewael, will be now taken from Sotheby's auctioneers, where it has been held for safekeeping, and returned to public display in the German city of Gotha.
The battle over its fate between a Panamanian company, Cobert Finance SA, and the Federal Republic of Germany and Gotha was regarded as a test case for thousands of stolen art works.
Up to 300,000 important paintings have not been seen since the war.
If Cobert had won, the market might have seen a flood of looted works whose owners finally felt able to sell without fear of legal challenge.
But Dr Michael Carl, a solicitor for the German authorities, said their success meant the art world would have to look much more carefully at the question of ownership. "This is a very important test case," he said.
The High Court had heard that the story of the painting read like an episode from a detective novel. The 8in by 6in work, painted on copper in 1603, was owned by the dukes of Saxe-Coburg-Gotha from 1826 until 1928 when it was transferred into a Foundation for Art and Science set up by the family.
But at the end of the war, it disappeared. The court heard conflicting tales of what had happened since.
Cobert claimed that a German family gave the picture to a colonel in the Soviet Army, Adolf Kozlenkov, who took it to Latvia.
It allegedly passed through friends to Moscow, on to West Berlin with an African diplomat and eventually arrived in Britain, where in 1988 a Mrs Mina Breslav offered it to Sotheby's.
Cobert bought it instead and left it with the auctioneers, but media attention sparked interest in the work and the Germans applied for an injunction preventing its sale.
But Mr Justice Moses said he did not believe that the painting was ever a gift. The evidence pointed to the work being looted as the Red Army swept through Germany and Smersh, the predecessors to the KGB, seized works of art as trophies of war.
The painting ended up in Russia where, in 1987, it was smuggled out by Mariouena Dikeni, known as "Big Mamma," the wife of the Togo ambassador in Moscow who had previously smuggled works of art for an icon dealer.
From there, the plot became more confused still and some questions were left unresolved after Douglas Montgomery, who was involved with Cobert, disappeared from the High Court hearing amid allegations of attempts to bribe witnesses.
Mr Justice Moses said that Cobert had deliberately concealed facts in the dispute.
In 1991, Mr Montgomery had told an art dealer that the painting was stolen, but in court Cobert claimed it was a gift, a distinction which, if true, would help its claim. Cobert argued that under a limitation period set out in German law, the authorities had only 30 years from when the painting was removed from Gotha to claim it.
But Mr Justice Moses said: "To allow Cobert to succeed when, on its own admission, it knew or suspected that the painting might be stolen ... does touch the conscience of the court. The law favours the true owner of property which has been stolen, however long the period which has elapsed since the original theft."Reuse content