Scotland's top legal officer, Lord Advocate Frank Mulholland QC, has announced he is to step down from the role.

Mr Mulholland, who leads the prosecution service, has informed the government he will leave the post after five years following May's election.

He said the Crown's expertise in dealing with domestic abuse and serious organised crime has seen the prosecution service become "one of the most effective in the world".

He said: "It has been a real privilege to serve as Lord Advocate, leading Scotland's prosecution service and providing independent legal advice to the Scottish Government.

"However, after nine years as a Law Officer - the last five as Lord Advocate - I have decided it is the right time to step down and do other things.

"In recent years the Crown has embedded specialisms in the way it does its job.

"Our expertise in handling offences including rape, domestic abuse, serious organised crime, counter-terrorism and cold cases has helped us become one of the most effective prosecution services in the world and given victims greater confidence to report crimes.

"It's been an honour to do this job working with so many dedicated and talented people to deliver justice in some of the most demanding and challenging of cases."

First Minister Nicola Sturgeon tweeted: "Frank Mulholland has been an outstanding Lord Advocate. He has my thanks and admiration for his service to Scotland."

The Lord Advocate has faced some criticism during his tenure, most notably over the Crown's decision not to press charges over the Glasgow bin lorry crash.

The families of some of the victims of the 2014 tragedy are now pursuing a private prosecution against the driver.

Mr Mulholland will formally step down when his successor is appointed by the Queen.

Ms Sturgeon said the Lord Advocate, who joined the fiscal service as a depute more than three decades ago, had made a "substantial contribution to the law and Scottish society".

The First Minister highlighted Scotland's first successful double jeopardy murder prosecution, led by Mr Mulholland, and his role in efforts to tackle cross-border human trafficking.

She added: "He has introduced a number of significant reforms to the Crown Office including the establishment of the National Sexual Crimes Unit and the appointment of Scotland's first specialist prosecutor to deal with domestic abuse - two reforms which have strengthened the rights and confidence of victims of these horrendous crimes.

"It is worth noting that the final Bill considered by the Scottish Parliament in the current session includes provisions for a new specific offence against the unauthorised sharing of intimate images, an issue which he played an essential role in highlighting.

"It is clear that he has worked to bring about change to ensure that the system makes a real difference to people's lives and his dedication to the law and his compassion for others has been behind that drive."