Image caption Alex Neil and Richard Lochhead have been in SNP cabinets for almost a decade

Richard Lochhead and Alex Neil have stepped down from the Scottish cabinet.

Rural affairs secretary Mr Lochhead signalled his decision to quit ahead of a reshuffle to Holyrood's top team.

Social justice minister Mr Neil also wrote to First Minister Nicola Sturgeon telling her he would no longer continue as a minister.

SNP leader Ms Sturgeon, who won the Holyrood election last week, has now made public her new cabinet.

She said John Swinney would become Scotland's new education secretary.

Mr Swinney had previously been Scotland's finance secretary, as well as the country's deputy first minister.

Former Transport Secretary Derek Mackay has been promoted to Finance Secretary, with Keith Brown becoming the Economy Secretary.

Both roles had previously been filled by Mr Swinney, but have now been separated into two.

Mr Mackay will have responsibility for the Scottish budget and the raft of new tax and welfare powers that are being devolved to the Scottish Parliament, in a role that has been described as similar to the UK Chancellor.

Image caption There are five men and five women - including first minister Nicola Sturgeon - in the reshuffled Scottish cabinet

Elsewhere, Shona Robison will remain as the health secretary, with Michael Matheson keeping his justice brief.

Angela Constance - who had been Education Secretary - has become the Cabinet Secretary for Communities, Social Security and Equalities.

And Fiona Hyslop continues as the Culture, Tourism and External Affairs Secretary.

Roseanna Cunningham becomes Cabinet Secretary for Environment, Climate Change and Land Reform.

Fergus Ewing becomes the Rural Economy and Connectivity Secretary.

News of Mr Lochhead's departure from the cabinet came in the wake of his wife Fiona disclosing late last year that she was suffering from breast cancer.

The MSP for Moray said this had helped him come to the conclusion that he needed to "change the priorities" in his life.

Media playback is unsupported on your device Media caption Nicola Sturgeon is formally sworn in as first minister of the Scottish Parliament

In a letter to the first minister, Mr Lochhead added that it had been an "absolute privilege" to serve in the cabinet, first under Alex Salmond and now Ms Sturgeon.

Nicola Sturgeon, in reply, said he left "a rich and enduring legacy of achievement".

She has also signalled privately that Mr Lochhead could be welcomed back into government at a future date.

Farming areas

There had been speculation that Mr Lochhead might be moved from rural affairs.

It followed a long-running controversy over the failure to process the transfer of Common Agricultural Policy payments to farmers. This issue was thought to have caused the SNP electoral problems in farming areas.

Audit Scotland is due to publish its report into the affair on Thursday.

Image caption John Swinney (left) and Derek Mackay were the first to arrive at Bute House as Ms Sturgeon started her reshuffle

One newly elected Liberal Democrat MSP, Mike Rumbles, had signalled his intention to seek to subject Mr Lochhead to a parliamentary vote if he were to continue in office - in effect, a vote of confidence.

But the exchange of letters between Mr Lochhead and Ms Sturgeon makes no mention of that, stressing instead the former minister's achievements and the challenge posed by his wife's illness.

In his resignation letter to Ms Sturgeon, Mr Neil said: "I believe we have laid the basis for an ambitious programme of reform for the next five years, especially in relation to housing, planning and social security policy.

"However, I now intend to concentrate on my constituency and other work which cannot be easily done whilst serving in the cabinet."

Ms Sturgeon said Mr Neil had served "with distinction" and leaves "a rich enduring legacy of achievements" across the portfolios he was responsible for.

She noted his role in taking equal marriage legislation through Holyrood and his work on inequalities, housing, planning and social security.