Scotland’s most senior law officer, Lord Advocate James Wolffe, and the Solicitor General are to resign.
The Scottish Government said Mr Wolffe and Alison Di Rollo, who supports the Lord Advocate, will stand down once new law officers are appointed.
The Lord Advocate is head of the body responsible for prosecutions in Scotland.
In February, former first minister Alex Salmond said Mr Wolffe should resign over his role in the Scottish Government’s handling of harassment complaints against him.
Speaking before a Scottish Parliament inquiry into the affair in March, Mr Wolffe denied any political influence relating to Mr Salmond’s criminal prosecution, which ultimately saw him acquitted of 13 charges at Edinburgh’s High Court last year.
Mr Wolffe told the Holyrood committee: “Any suggestion, from any quarter, that the Crown’s decision-making has at any time been influenced by irrelevant considerations or improper motivations would be wholly without foundation.
“Insinuation and assertions to the contrary are baseless.”
Mr Wolffe also made a public apology over the wrongful prosecution of two men – before he became Lord Advocate – following a fraud investigation relating to the sale of Rangers.
David Whitehouse and Paul Clark had been appointed joint administrators of the club in 2012, but were arrested in 2014 regarding their involvement with the administration.
The pair were awarded more than £20 million after charges brought against them were dropped or dismissed.
The Lord Advocate is also a minister in the Scottish Government and its principal legal adviser.
Scottish Labour has called for the dual role to be separated after the Scottish Government’s botched handling of complaints against Mr Salmond.
A Scottish Government spokesman said: “The Lord Advocate informed the First Minister last year that he intended to leave office following the recent election and confirmed his intention before her re-election by the Scottish Parliament as First Minister.
“The Solicitor General has confirmed her intention to stand down at the same time.
“It is for the First Minister to nominate new law officers and, subject to approval of her nominees by the Scottish Parliament, to recommend their appointment to Her Majesty the Queen.
“The current law officers intend to remain in office until the new law officers are appointed.”