Thousands of gay and bisexual men are to be formally pardoned after a new law was passed unanimously by the Scottish Parliament.
Consenting sexual activity between men over the age of 21 was only decriminalised in Scotland in 1981.
It was a further 20 years before the age of consent for gay men was lowered to 16.
The new law will pardon men convicted of having consensual sex with other men before it was decriminalised.
It will also enable men to apply to have convictions for same-sex sexual activity that is now legal removed from central criminal conviction records – with the Scottish government saying it expects about 25 men to do so over the next five years.
But it will not apply to behaviour that is still illegal today – for example rape or having sex with someone under the age of 16.
Why were gay men prosecuted?
Before the law changed, men were prosecuted for offences including consensual sexual activity in private, kissing another man in a public place, or just chatting up another man in a public place – which was known as “importuning”.
Such behaviour was legal at the time between a man and a woman, and is legal today between two men.
The Equality Network charity estimates that the total number of these historical convictions in Scotland runs into thousands, and that there are hundreds of men alive today with such convictions on their records.
Sex between women was never criminalised in this way in Scotland, and the same rules applied to it as applied for sex between a man and a woman.
The Historical Sexual Offences (Pardons and Disregards) Bill had received strong cross-party support since being introduced by the Scottish government in November.
At the time, First Minister Nicola Sturgeon offered an “unequivocal apology” to men who had been “convicted as criminals, simply for loving another adult”.
She said: “Those laws criminalised the act of loving another adult, they deterred people from being honest about their identity to family, friends, neighbours and colleagues.