MEN in Scotland arrested for being gay before homosexuality was legalised in the early 80s will have their criminal records scrubbed clean, after MSPs unanimously backed new measures to automatically pardon people convicted under historical discriminatory laws.

The legislation will also allow the men to apply for past convictions to be legally disregarded.

Private same-sex activity between two men aged over 21 was illegal in Scotland until 1980, 13 years after it was decriminalised in England and Wales. The age of consent for gay men was only reduced to 16 in 2001.

Justice Secretary Michael Matheson called it a “proud day” for Scotland.

He said: “No-one needs reminding of the damage done to people’s lives by these discriminatory and unjust laws, and that such damage cannot be undone.”

Colin Macfarlane, director of Stonewall Scotland, said the bill would “provide justice” for the many gay and bisexual men convicted for consensual acts.

“We thank all those MSPs who spoke up for LGBT rights in the debate today and to all the individuals who have campaigned over many years to make this moment a reality We hope this will now help many draw a line, once and for all, under a dark period in our history,” he said.

Though there was cross-party support for the law, and even though he voted for it, SNP backbencher John Mason sparked a row after it was revealed he had told a constituent he did not agree with “retrospective pardons and apologies”.

The Shettleston MSP compared the law to asking the “Italians be apologising for the Roman occupation”.

The comments were passed on to Scottish Greens co-convener Patrick Harvie, who read them out in the chamber and blasted Mason’s “complete absence”. “This is not ancient history, this is living history,” he said.

“Many of the people whose lives were subject to untold harm by their own government are still living and they do not deserve to be dismissed in this way,” he added.

Harvie criticised the SNP for selecting Mason as a candidate: “Political parties whose leaders oppose racism would be condemned and rightly so for continuing to select racist candidates for election at any level.

“Political parties whose leaders oppose sectarianism would be condemned and rightly so for continuing to select candidates for election at any level who were sectarian.

“In the same way political parties whose leaders oppose prejudice and discrimination on grounds of sexuality and gender identity should be condemned for continuing to select homophobic, biphobic or transphobic candidates for election at any level.”

In an intervention, Mason told Harvie that “a range of people” with strong religious beliefs thought that “it is wrong for one person of the same sex to have a sexual relationship with someone else.”

Mason then told Harvie that “tolerance” was “an important virtue”.