The First Minister will apologise on behalf of the Scottish Government to all men convicted of now-abolished sexual offences.

Nicola Sturgeon will make the apology at Holyrood on Tuesday November 7 to coincide with the publication of new legislation to provide an automatic pardon to all those affected.

The legislation was promised by Ms Sturgeon when she presented her programme for government in September.

It will enable people to apply to have such convictions removed from central criminal conviction records.

READ MORE: Prisoners on day release will be allowed to return home to vote

A Scottish Government spokesman said: "The First Minister will give a statement of apology to those convicted prior to 2001 under discriminatory laws against same-sex sexual activity that is now legal.

"The apology will be made on behalf of the Scottish Government for the treatment of homosexual men under previous governments and will coincide with the introduction of legislation to provide people convicted under these laws an automatic pardon.

"The Bill will right a historic wrong and give justice to those who found themselves unjustly criminalised simply because of who they loved."

The legislation was first confirmed by Justice Secretary Michael Matheson in October last year.

He announced plans for automatic pardons just days after similar legislation was scuppered at Westminster.

The private member's bill would have pardoned all men living with UK convictions for same-sex offences committed before the law was changed.

READ MORE: Prisoners on day release will be allowed to return home to vote

However the UK Government, which has its own plans for posthumous pardons, "talked out" the bill in the Commons, resulting in it falling at its first parliamentary hurdle.

Tim Hopkins, director of the Equality Network, said: "The apology is important because it shows that it was the discriminatory laws that were wrong, and not the consensual relationships that were made criminal by those laws.

"We look forward to seeing the detail of the bill. If it implements the policy announced by the Scottish Government, it will be a hugely important statement that Scotland regrets the discrimination of the past, and now considers its LGBTI people to be fully equal citizens who deserve equal respect.

"It will also be of direct practical importance to people who currently have one of these convictions show up on criminal record checks for jobs or volunteer posts."

READ MORE: Prisoners on day release will be allowed to return home to vote

Green MSP Patrick Harvie said: "The legal exoneration of people convicted under unjust laws is long overdue and I'm pleased that the First Minister feels that it's appropriate to make an apology on behalf of Scotland at the same time.

If we're serious about this, all political parties should start to show less patience with their own anti-equality voices, and stop selecting candidates who will stand in the way of progress.

"We must also work harder to ensure that schools monitor and tackle homophobic, biphobic, and transphobic bullying so that young LGBTI people growing up today never have to face the kind of oppression experienced by previous generations."