Scotland's Lord Advocate, Colin Boyd, has announced that he is stepping down after six years in the post.
Colin Boyd faced a massive test soon after his appointment
Mr Boyd was at the pinnacle of the Scottish legal establishment, leading the Crown Office and Procurator Fiscal Service.
During his time in charge he has overseen legislation enacted in a newly devolved Scotland and some of the most high profile cases of recent years.
His first major challenge came shortly after his appointment in 2000.
The bombing of a United States-bound Pan Am flight in 1988 with the deaths of 270 people has been regarded as the worst crime in Scottish legal history.
After much diplomatic wrangling, Libyans Abdelbaset Ali Mohmed al-Megrahi and Al-Amin Khalifa Fhimah were put on trial in unique legal proceedings at a special high security courtroom in the Netherlands.
Three judges heard the evidence without a jury in 2001 and found Megrahi guilty, sentencing him to life imprisonment. Fhimah was acquitted.
Five judges then heard an appeal in 2002 from Megrahi and decided that the guilty verdict should stand but the legal wrangling continues.
Megrahi's legal team is challenging his 27-year minimum prison sentence and the Crown Office is arguing for a longer sentence.
In February 2006, Lord Boyd was drawn into the fingerprint case involving former police officer Shirley McKie.
She was wrongly accused of leaving her thumb print at a murder scene in January 1997.
Lord Boyd has been criticised for his decision not to prosecute Scottish Criminal Records Office officials.
Tam Dalyell, the former MP, asked Lord Boyd to review his position while former MSP Mike Russell maintained that he could not continue as lord advocate.
The case of Surjit Singh Chhokar was a low point
In 2002, Lord Boyd admitted that his office had "failed" the family of Surjit Singh Chhokar while prosecuting two men accused of murdering the 32-year-old waiter.
His remarks came after two independent reports identified failings in the way the case was handled by the police and the Crown Office and Procurator Fiscal Service.
While in office, Mr Boyd oversaw reforms of the high court system, recommended by Lord Bonomy.
However, he has expressed disappointment at being unable to see through proposals on the independence of the judiciary, affected by the illness of the Lord President, Lord Hamilton.
He has overseen the introduction of youth courts and the implementation of modern technology, with changes in working practices in local courts.
The way rape victims were treated in Scottish courts was re-examined by the lord advocate when a teenage rape victim committed suicide after being forced to give harrowing evidence to a jury.
The Sexual Offences (Procedure and Evidence) Act 2002 was introduced after an inquiry into Lindsay Armstrong's death concluded that she had killed herself after enduring a brutal cross-examination in court.