Richard Lochhead has left his post as cabinet secretary for rural affairs.
In one of her first acts as first minister, Nicola Sturgeon accepted the Moray MSP’s resignation from her government.
Mr Lochhead had faced sustained criticism over his handling of a £178million IT bungle which led to millions of pounds of subsidy payments to farmers being delayed.
Opposition parties had demanded Mr Lochhead be sacked from Ms Sturgeon’s new cabinet over the fiasco.
But last night the first minister defended his record, saying he left a “rich and enduring legacy of achievement”.
Mr Lochhead, who was first elected to parliament in 1999, said he was “very proud” of his time in government and would “take away many precious memories”.
In a letter to the first minister seen by the Press and Journal, he said he was choosing to leave office to spend more time with his family, ruling out serving in another government post.
In October, Mr Lochhead’s wife of 13 years, Fiona, was diagnosed with breast cancer.
Writing to Ms Sturgeon, he said: “After much thought in recent months, I have taken the decision that after nine incredible but hectic years as cabinet secretary the time has come to change the priorities in my life, especially in light of recent family circumstances.
“I now wish to focus more on supporting Fiona and also my young sons, Angus and Fraser, who are growing up fast and whom I want to see more of in the next few years.
“I am very proud to serve Moray in the Scottish Parliament and look forward to continuing to serve my constituents to the best of my ability.
“For these reasons, I no longer wish to hold ministerial office.”
He said it was “an absolute privilege” to have been in an SNP government and said he would have “never dreamt” of having the opportunity to do so when he joined the Nationalists as a teenager.
The first minister thanked Mr Lochhead, whose portfolio also includes food and the environment, for his service.
In a letter to him she said: “You have served under both Alex Salmond and myself with distinction and you leave a rich and enduring legacy of achievement in your policy portfolio.
“Chief among this is overseeing the world-leading efforts to tackle climate change which we have brought forward, as well as the unprecedented success now being enjoyed by Scotland’s food and drink industry, which is booming in no small part for the efforts you have made on the sector’s behalf.
“I know you will take personal satisfaction in our efforts to clean up the marine environment and the related legislation we have passed in that area.
“You have always been an articulate and robust defender of our farmers and fishermen in Europe, despite the challenges posed by the fact that Scotland’s ministers are all top frequently locked out of key discussions.”
Ms Sturgeon will put her proposals for a new cabinet before MSPs tomorrow.
Life and times of Riichard Lochhead
Richard Lochhead grew up in Glasgow, joining the SNP as a teenager in the 1980s.
After studying politics at Stirling University, he took on the role of office manager for the then Banff and Buchan Coast MP, Alex Salmond.
Mr Lochhead was elected in 1999 to represent the North East region, after a brief stint working with Dundee City Council.
Re-elected in 2003, he stood down from his regional seat in April 2006 to contest the Moray by-election following the death of Margaret Ewing, which he won with more than 46% of the vote.
As the SNP’s spokesman on environment, energy, rural affairs and fishing in opposition, he was promoted to secretary for rural affairs and the environment in May 2007 as part of Mr Salmond’s minority government.
The responsibility for food was added to his ministerial portfolio in November 2014.
During his tenure, he had a number of notable successes, including recently laying the groundwork for an embargo on Haggis imports to the United States to be lifted.
His wife Fiona, who was diagnosed with breast cancer in autumn last year, has run a high-profile campaign to encourage other women to take time to check their breasts.
Mr Lochhead also cycled the gruelling 66-mile Etape Loch Ness 2016 to raise money for Macmillan Cancer Support, who helped his wife when she received her diagnosis.
Mr Lochhead, who will continue as a MSP for Moray, lives with his wife and sons Angus and Fraser in Elgin.