Widows and widowers of police officers and firefighters killed in the line of duty will now receive their deceased partner's pension even if they remarry.

Under the previous system, some partners of officers killed on duty lost their loved one's pension if they remarried, formed a civil partnership or moved in with a new partner.

The Scottish Government said the new rules would apply in situations where the pension had already been withdrawn.

Justice Secretary Michael Matheson said: "It is simply not right that the loved ones of those who have given their lives to protect our communities are denied what is rightfully theirs and, while improvements to our public sector pensions are not usually applied retrospectively, today's announcement reflects our thanks to those who have made the ultimate sacrifice.

"I am committed to ensuring the Scottish Government reinstates this entitlement to those eligible as soon as possible and I have asked the Scottish Public Pensions Agency to take the necessary action to implement this change quickly."

Brian Docherty, chairman of the Scottish Police Federation, which represents rank-and-file officers, said the announcement " rights a long-standing and historic wrong".

"We are particularly delighted that the government has gone further and agreed to reinstate previously withdrawn pension for those who lost loved ones but were fortunate enough to love again later in their lives," he said.

Chris McGlone, Fire Brigades Union (FBU) executive council member for Scotland, added: "The FBU know this announcement will be welcomed by widows/widowers/civil partners of firefighters killed in the line of duty and would urge those in authority to implement the effect of this decision as soon as possible."