A high-ranking Nazi officer who helped develop a mobile gas chamber became a spy for West Germany after World War II, archives have revealed.
Former SS officer Walther Rauff worked for West German intelligence service, the BND, between 1958 and 1962.
In hindsight, his recruitment was "politically and morally incomprehensible", said BND historian Bodo Hechelhammer.
Rauff died in Chile in 1984, having evaded trial for war crimes.
The charges related to his time as an official of the criminal technical institute of the Reich security main office, which he joined in 1941.
As US intelligence later put it, Rauff designed gas vans used to murder Jews and people with disabilities.
With German defeat he fled to Chile and changed his name to Enrico Gomez.
Fought extradition
But the BND traced him and recruited him as spy, ostensibly to go to Cuba to spy on leader Fidel Castro.
He was denied entry but still earned more than DM70,000 ($18,000, £11,500) during his time with the service.
Publicly he became a wanted man when his wartime role was brought to light but - even after his arrest by Chilean police in 1962 - he was being supported by the BND.
Mr Hechelhammer disclosed that the agency was paying his legal bills as he fought extradition.
The historian also says that he had secretly come to Germany twice on a course run by the BND.