At the end of the 1930s, Vallejo decided to prove exactly that. The solution, he decided, lay in an abandoned monastery at San Pedro de Cardena, near Burgos, which had become a makeshift jail for captured volunteers from the pro-republican International Brigades.

It was here, in 1938, that International Brigade members were subjected to a bizarre set of physical and psychological tests in one of the first systematic attempts to put psychiatry to the service of ideology. Sixty-four years later, the results of Vallejo's project to unravel the "biopsyche of Marxist fanaticism" have finally come to light.

Former prisoners at San Pedro de Cardena remember being subjected to up to 200 tests. They were quizzed on their sex lives, and had their heads and noses measured.

"They made us strip and did all these measurements. We supposed they thought it would be useful if the fascists ever invaded Britain," says Bob Doyle, one of the few remaining survivors of a group of 75 British and Irish prisoners tested at the camp. Another, Carl Geiser, the senior ranking American in the jail and a former political commissar to the Abraham Lincoln Brigade, recalls: "I was photographed with just a small cloth over my penis."

Two men dressed in civilian clothes went through a long list of questions in a small office before the prisoners were taken outside. It took them several days to survey some 200 British, Irish, American, Canadian, Portuguese and Latin American prisoners.

"An assistant... called out the length, breadth, and depth of his skull, the distance between his eyes, the length of his nose, and described the skin colour, body type, wound scars and disability," Geiser recalled in his 1986 book, Prisoners of the Good Fight. "Each prisoner was instructed to stand in front of a camera for a front and side view, and a close-up of the face. We were now 'scientifically' classified."

The results of Vallejo's tests were published in a military medical journal that languished in Spanish libraries until historian Ricard Vinyes unearthed them for his book, The Lost Children of Franco.

The results would be laughable, if Vallejo had not been a man of influence. At the time of the study, he was the Spanish army's chief psychologist. He went on to become Spain's most important psychiatrist, holding the country's first-ever university chair in the subject, writing dozens of books and taking part in international conferences until his death in 1960.

His conclusions ranged from the sublime to the sinister. The report claimed, for example, that 58%of English prisoners were "single men with sexual experience outside prostitution", that 7% were recruited "by charlatans in Hyde Park", that 17% had signed up in "employment agencies". All (three) Welsh prisoners were "alcoholics", he found.

"A priori, it seems probable that psychopaths of all types would join the Marxist ranks," he reasoned before starting the project. "Since Marxism goes together with social immorality... we presume those fanatics who fought with arms will show schizoid temperaments."

Little surprise, then, that he classified almost a third of the English prisoners as "mental retards". Another third were deemed to be suffering degenerative mental illnesses that were turning them into schizoids, paranoids or psychopaths. Their fall into Marxism was, in turn, exacerbated by the fact that 29% were also considered "social imbeciles".

"Once more we see confirmed that social resentment, frustrated aspirations and envy are the sources of Marxism," he added. "The persistence of the ideological attitude of the English Marxists is the result of their closed minds and lack of culture."

The results, predictably concluding that Marxists really were mad, tell us more about the mindset of those who, with Franco at the helm, would run Spain for the next 40 years than about the British and other men at San Pedro de Cardena. They also reinforced the use of one of Franco's preferred political solutions for his opponents - the firing squad. Those who could not be saved were better dead.

Brigade members still alive today have been astonished to hear of Vallejo's study. They had thought it was visiting Gestapo officers who carried out the tests. It now seems more likely that, if Gestapo men were present, they were sharing their experiments with Vallejo, a fluent German speaker. Whoever it was carrying out the tests, however, the prisoners were pretty clear what they were for. "They wanted to prove we were subnormal," says Geiser.

The prisoners' response was to make a mockery of the tests. Sexual boasting was combined with careful avoidance of anything that might see them shot at dawn the next day.

Life in the prison may have been harsh but the Brigade member's spirits, and convictions, remained unbroken. "It was grim. No windows, just bars. It was cold. There was a stone floor and no bedding. Sanitation was minimal. You'd get a very small loaf of bread once a day, otherwise only beans," Dave Goodman, a British brigade member, told the Guardian shortly before his death last year.

Vallejo decided for himself, wrongly, that all International Brigade members were avowed Marxists. "In the concentration camps, some of us were democrats, anarchists, some were communists... The thing we learned was that we all had to stick together," says Geiser.

The Spanish psychiatrist was a much-decorated army doctor who had served as a military attache in Spain's Berlin embassy. He was in tune with the "advances" of Hitler's nazi psychiatrists, who were already busy sterilising tens of thousands of people deemed threatening to the Aryan gene pool.

Vallejo, too fervent a pro-life Catholic to go to such extremes, had already come up with his own proposals for purifying a Hispanic race that, he claimed, had lost vigour from five centuries of intermingling with Jewish converts to Catholicism. Pre-selection of suitable breeding candidates would, he affirmed in a book called Eugenesia of the Hispanic People and Regeneration of the Race, restore "nobility".

The final conclusions of his study may have helped justify the firing squads that dispatched between 30,000 and 50,000 republican sympathisers, but they will please most of the surviving International Brigade members. Despite the pressures of jail, 85% of them refused to express regret for fighting to save the elected republican government.

"The English subjects have participated much more in the fighting than the Americans, judging by the number of wounded... The immense majority remain firmly attached to their ideas," Dr Vallejo concluded.