German divers who recently fished an Enigma encryption machine out of the Baltic Sea, used by the Nazis to send coded messages during World War II, handed their rare find over to a museum for restoration on Friday.

The legendary code machine was discovered last month during a search for abandoned fishing nets in the Bay of Gelting in northeast Germany, by divers on assignment for environmental group WWF.

"A colleague swam up and said: there's a net there with an old typewriter in it," Florian Huber, the lead diver, told the DPA news agency.

The team quickly realised they had stumbled across a historic artefact and alerted the authorities.

Ulf Ickerodt, head of the state archaeological office in Germany's Schleswig-Holstein region, said the machine would be restored by experts at the state's archaeology museum.

The delicate process, including a thorough desalination process after seven decades in the Baltic seabed, "will take about a year", he said.

After that, the Enigma will go on display at the museum.

Christian Howe, Florian Huber and Uli Kunz (Uli Kunz/WWF/submaris/AFP)Christian Howe, Florian Huber and Uli Kunz (Uli Kunz/WWF/submaris/AFP)

Naval historian Jann Witt from the German Naval Association told DPA that he believes the machine, which has three rotors, was thrown overboard from a German warship in the final days of the war.

It is less likely that it came from a scuttled submarine, he said, because Adolf Hitler's U-boats used the more complex four-rotor Enigma machines.

The Allied forces worked tirelessly to decrypt the codes produced by the Enigma machine, which were changed every 24 hours.

British mathematician Alan Turing, seen as the father of modern computing, spearheaded a team at Britain's Bletchley Park that cracked the code in 1941.

The breakthrough helped the Allies decipher crucial radio messages about German military movements. Historians believe it shortened the war by about two years.

The story was turned into a 2014 movie called "The Imitation Game", starring Oscar-nominated British actor Benedict Cumberbatch as Turing.

© Agence France-Presse