Scotland's First Minister Nicola Sturgeon on Thursday announced the suspension of her finance minister and a full investigation after revelations he sent a string of messages to a 16-year-old schoolboy.
Scottish National Party (SNP) leader Sturgeon faced a barrage of questions in the devolved parliament in Edinburgh about the scandal involving Derek Mackay, which was detailed in the Scottish Sun tabloid.
Mackay, 42, resigned with immediate effect, just hours before he was due to deliver a set-piece address announcing the government's budget.
"Derek Mackay has apologised unreservedly for his conduct and has recognised, as I do, that it was unacceptable and falls seriously below the standard required of a minister," Sturgeon told parliament.
"I can also advise that he has of this morning been suspended from the SNP and our parliamentary group, pending further investigation."
Mackay was once touted as a possible successor to Sturgeon, who has been leading the campaign for a new referendum on Scottish independence.
"Rugby match"
The newspaper reported that Mackay, a father of two who came out as gay and separated from his wife in 2013, befriended the schoolboy on Facebook and Instagram.
He reportedly sent him 270 social media messages over a six-month period.
In one message, he is alleged to have asked: "And our chats are between us?" And when the boy agreed, he told him: "Cool, then to be honest I think you are really cute."
The tabloid said Mackay- finance minister since 2016- offered to take him out to dinner and a rugby game.
"I take full responsibility for my actions. I have behaved foolishly and I am truly sorry," Mackay said in a statement. "I apologise unreservedly to the individual involved and his family.
"I spoke last night with the first minister and tendered my resignation with immediate effect.
"Serving in government has been a huge privilege and I am sorry to have let colleagues and supporters down."
"Rising star"
The revelations come as Sturgeon faces a row with UK Prime Minister Boris Johnson over his refusal to allow a new vote to decide if Scots should go their own way after 300 years of union.
Scotland has its own devolved parliament controlling policy and spending on areas such as health and education. It also has tax-raising powers.
The Scottish Sun published full threads of messages dating from August 2 last year until February 1.
Mackay contacted the boy out of the blue and asked what age he was, saying "oh right" after being told he was 16.
The teenager's mother, 37, learned of the exchanges last week. "If I could speak to him, I would ask him 'Why? Why did you do this?'," she was quoted as saying.
"You can see he tries again and again- like he is trying to get my son to change his mind about something. He is trying to see how much he can push it."
Murdo Fraser, finance spokesman for the main opposition Conservatives in the Scottish Parliament, said Mackay was popular across the chamber.
"This is, however, a huge blow for Nicola Sturgeon to lose such a key member of her government at such a crucial time- and one tipped as her successor."
Sturgeon said she was not aware of any further allegations or any conduct of a similar nature by Mackay- or the boy's identity- and only became aware of the revelations on Wednesday evening.
"Based on what I knew last night, it was clear that Derek Mackay remaining in government was simply not an option," she told lawmakers.
"He clearly offered his resignation because he recognised that as well."
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)Track Latest News Live on NDTV.com and get news updates from India and around the world