By Sarah Rainsford
BBC News, Madrid
The law was introduced under Gen Francisco Franco
A man in eastern Spain has become the first to receive an official letter apologising for his imprisonment in the 1970s for being homosexual.
Antoni Ruiz spent three months in prison under a law introduced during Gen Francisco Franco's dictatorship.
In addition to the letter, he has received 4,000 euros ($5,900; £3,600) in compensation.
Mr Ruiz estimates around 5,000 homosexuals suffered a similar fate to him during Gen Franco's dictatorship.
Historical Memory law
When he was 17, Antoni Ruiz told his family he was gay.
It was 1976, just months after Gen Franco had died and homosexuality was strictly illegal.
When Antoni's worried parents confided in a Catholic monk, he promptly denounced their son to the authorities.
The teenager spent three months in prison and was banned from returning home for another year.
Mr Ruiz, who now heads an association for other former prisoners, has become the first to receive official recognition of his suffering, in a letter from the justice minister of Spain.
More than three decades after his ordeal, Mr Ruiz told the BBC that the letter amounts to an apology, and says it is far more important to him than the financial compensation.
He has benefited from Spain's Historical Memory law that was passed in 2007 and broke a three-decade long pact of silence about crimes committed by the state during the Spanish Civil War and the long dictatorship of Gen Franco.
The law banning homosexuality was overturned in 1979, and Antoni Ruiz says he is proud that Spain today is extremely tolerant.
Despite its mainly Catholic population, it was one of the first countries to legalise same-sex marriages, and give gay couples the same right as anyone else, to adopt children.