Education Minister Peter Peacock has resigned for health reasons, the Scottish Executive has confirmed.
An executive spokesman said Mr Peacock had been receiving medical advice for a condition likened to a mild stroke.
The 54-year-old Highlands and Islands MSP, who is married with two adult sons, said a sustained period of ill health had prompted his decision.
It was later announced that Deputy Justice Minister Hugh Henry would succeed Mr Peacock.
In his resignation letter to First Minister Jack McConnell, Mr Peacock said: "As I advised you over the weekend, it is with great regret that I have had to step down as minister for education and young people with immediate effect.
"As you are aware, I have been experiencing a prolonged period of poor health.
"It has become increasingly apparent that a ministerial lifestyle is not conducive to either promoting or maintaining my health and following further recent difficulties and advice, I have concluded that I must give my health priority attention."
In reply, Mr McConnell told Mr Peacock: "I am extremely sorry that you have had to take this decision but entirely understand your reasons for doing do."
The first minister went on to praise Mr Peacock's tenure in education, saying the education system was in good shape, morale was high and the number of new teachers entering the profession was "extremely encouraging".
"In secondary schools last year more than 90% of pupils were awarded a Standard Grade or equivalent in English and maths," he said.
"Perhaps most impressively of all, our 15-year-olds are amongst the top performing in the world for maths, science and literacy.
"These are significant achievements of which you can be justifiably proud."
An executive spokesman said: "I am told he has been experiencing a series of episodes which leave him feeling unwell and with symptoms akin to having had a minor stroke.
Jack McConnell paid tribute to his cabinet colleague
"The condition is ongoing, he had received medical advice, and the advice is to seek to reduce the risk factors of a major stroke.
"He had decided it's only fair for him and his family to stand down from what most people would accept is a demanding role as a cabinet minister."
The spokesman said he understood Mr Peacock intended to continue as an MSP.
Scottish Conservative leader Annabel Goldie said: "We are sorry to learn that Mr Peacock has had to resign on health grounds and on a personal level we wish him well."
Fiona Hyslop, the Scottish National Party education spokeswoman, also paid tribute to the list MSP.
"Peter Peacock has been the longest serving education minister under devolution and well respected in education circles and in the Parliament," she said.
"I wish him well for the future and thank him for his contribution to Scottish education."
Ronnie Smith, general secretary of the Educational Institute of Scotland, said: "Under his leadership, Scottish education has moved forward significantly, with a high degree of consensus.
"The key to that consensus has been Mr Peacock's engagement with teachers and his recognition of the need to involve teachers fully in education reform."
David Eaglesham, general secretary of the Scottish Secondary Teachers' Association (SSTA), said: "While we fully understand the choice he has made and wish him future health and happiness, his departure is a significant loss for the education community in Scotland."
William Roe, chairman of Highlands and Islands Enterprise (HIE), paid tribute to Mr Peacock at the body's board meeting in Inverness.
He said: "I am personally shocked and really saddened by this news. He was an exceptional education minister and I think it's a great loss to Scotland and to the executive."