Captain Julius Morris Green of the Army Dental Corps was captured by Axis forces at St Valery in June 1940, spending the rest of the conflict in prisoner of war camps throughout Germany.
However his role as a dentist, which saw him journey between camps to treat fellow inmates, meant he was in a unique position to observe the activities of German forces while behind enemy lines.
He risked his life by sending a series of coded messages back to his family in Dunfermline, Fife, which gave British intelligence services a priceless insight into the activities of the enemy, after he was taught how to communicate covertly by other prisoners.
Capt Green was aware that his letters - which at times read like a caricature of a faulty language manual - would have been spotted as coded messages had the Nazis employed a censor with a good command of English. But he continued to spy for the British Directorate of Military Intelligence Section 9 (MI9) despite facing certain death if his deception was uncovered.
One, sent to his sister Kathleen in November 1943, read: "Are you very upset about the beret? Well never mind you couldn't help it. Here is the solution. It has produced a nice dressing gown. The thing fitted Davidson so he gave me a useful dressing gown for it & I'm delighted. In the end it's come even. The dressing gown is looked on in the aspect of the extremely useful substitute & the beret covers Davidson's bald patch"
Decoded, it means: "Probably only one truck of experimental luboil ever produced here."
The 40 coded letters, sent between 1941 and 1944, as well as papers and personal effects are to be auctioned at Bonhams next month, where they are expected to fetch between £4000 and £6000.
Capt Green, who was Jewish, spent time in Blechhammer, Lamsdorf, Sandbostel and Westertimke camps before being sent to Colditz, where the most troublesome prisoners were kept, in 1944. Messages he sent also contained details of German railway, troop and shipping movements. He died in 1990 aged 87.
Julian Roup of Bohams in London said: "Under the surreal humour of his letters lies horror and quite extraordinary bravery."
Capt Green spent his childhood in Ireland before studying at the Dental School of the Royal College of Surgeons in Edinburgh. He was practising in Glasgow when he joined the Territorial Army in 1939.
A letter from MI9 to Capt Green's parents in 1944 said: "We quite understand your very natural anxiety regarding your son's intentions, however Capt Green appears to be a young man of great resource."