A Spanish gay man who was sentenced to three months in jail in the 1970s has received an official apology from the government.

Antoni Ruiz, 50, was jailed in 1976 at the age of 17 after coming out to his parents. They confided in a Catholic monk, who told authorities.

According to the Daily Telegraph, he received a formal letter of apology last week from Spain’s justice minister and compensation of 4,000 euros (£3,600).

He is the first to receive such recognition.

The apology came under 2007’s Law of Historical Memory, which was designed to recognise victims who suffered under the dictatorship of General Franco.

Franco made homosexuality illegal and 5,000 men were thought to be imprisoned for related offences during his rule.

Ruiz was one of the few who was jailed in the year after the dictator’s death.

The law banning homosexuality was overturned in 1979 and Spain now offers gay couples the right to marry, making it one of the most gay-friendly countries in Europe.

In September, UK prime minister Gordon Brown made a formal posthumous apology to gay mathematician Alan Turing, who committed suicide after being forced to undergo brutal medical treatment when he was convicted of homosexuality.

Some critics welcomed the apology but said the estimated 100,000 other British men who were convicted of homosexuality offences should also receive similar recognition.