The First Minister has “categorically, unequivocally and wholeheartedly” apologised to all men convicted of now-abolished sexual offences.
Nicola Sturgeon made the formal apology on behalf of the Scottish Government as new legislation was published to provide an automatic pardon to all those convicted under discriminatory laws.
Her statement at Holyrood was welcomed by all the political parties and equality campaigners.
She said: “Scotland has travelled so far in recent years in relation to LGBTI equality, but it still shocks us to recall that as recently as 1980, well within my lifetime, consenting sexual activity between men was still classed as criminal activity and the age of consent was only lowered to 16 in 2001, two years after this parliament came into being.
“Before then, hundreds of people in Scotland were liable to be convicted as criminals simply for loving another adult.”
The new Historical Sexual Offences (Pardons and Disregards) (Scotland) Bill has both a “symbolic and practical” value, Ms Sturgeon told MSPs.
The legislation provides an automatic pardon to men convicted under historic discriminatory laws and establishes a new procedure to allow the removal of such convictions from criminal records.
The First Minister said: “The bill we have published today rights a historic wrong, however ... I want to go further today and do something that legislation on its own cannot do.
“A pardon is of course the correct legal remedy to apply for the convictions we are talking about today, but the term pardon might still – to some people – imply that parliament sees them as having done something wrong.
“However, as all of us know, that is not the case here.”
Ms Sturgeon continued: “The simple fact is that parliamentarians over many decades supported or at the very least accepted laws that we now recognise to have been completely unjust.
“So today as First Minister I categorically, unequivocally and wholeheartedly apologise for those laws and for the hurt and the harm that they caused to so many.
“Nothing that this parliament does can erase those injustices but I do hope that this apology, alongside our new legislation, can provide some comfort to those who endured those injustices.”
Scottish Conservative leader Ruth Davidson added her “unequivocal and wholehearted” apology to that of the First Minister.
Ms Davidson said: “We are not talking about a few unlucky individuals, we are talking about entire generations who faced the criminalisation of love.
“My hope for those men and their families is that they now feel a weight lifted and that as well as criminal records formally being wiped clean, any lingering sense of legal stigma, any last shadow of unfair disgrace, is firmly banished.
“And my hope for the young men of today is that they never know what it is like to fear their love being found out.”
Labour’s Kezia Dugdale said: “It takes a deep breath and a big heart to say sorry for mistakes of the past and an even bigger heart when those errors are not your own. So I offer the congratulations and gratitude of these benches to the government for stepping up and saying sorry today.
“Today is a landmark day in Scotland’s LGBT history. In apologising, the First Minister accepts that for Scotland to fulfil its vision of an inclusive future it must be at peace with its past. This Bill will bring that peace.”
Greens co-convener Patrick Harvie warned “we have made great progress, but that inequality, prejudice and bigotry persists still in our workplaces, in our schools, in our media and in our politics”.
He added: “Let us all recommit to continuing the progress and ensuring that the next generation has nothing to apologise for on our behalf.”
Scottish Liberal Democrat leader Willie Rennie said it was important to stand against the “serious oppression and mistreatment” of gay people around the world.
“We must continue that battle for people across the globe,” he said.