A rare surviving example of an Enigma machine, used by the German military to send coded messages during the second world war, is expected to fetch £70,000 at auction next week.

The machines were vital to the Nazi war effort but the Allies broke the codes – a feat said to have shortened the war by several years.

The work done to crack the codes by Alan Turing and fellow codebreakers at Bletchley Park was immortalised in the Benedict Cumberbatch film The Imitation Game.

The machine being offered for sale, which dates from 1943 and currently belongs to a European museum, will go under the hammer at Sotheby’s in London on Tuesday.

Few examples remain as many of the machines were destroyed by German forces as they retreated.