Scottish Finance Secretary Derek Mackay is interviewed in the lobby of the Scottish Parliament on the upcoming Scottish Budget, on January 21, 2020 in Edinburgh, Scotland.

Just hours before he was due to present his government's budget, Scotland's finance minister has been forced to step down following newspaper allegations that he sent hundreds of texts to a 16-year-old boy.

The Scottish Sun newspaper reported late Wednesday that Derek Mackay sent 270 messages to the boy over a six-month period. Mackay, who is 42 years old, allegedly told the boy in one message that he thought he looked "cute."

The report adds that the lawmaker continued to exchange messages on both Instagram and Facebook, even after the boy had said he was only 16 and that Mackay should not "try anything."

The newspaper added that the most recent messages were from earlier this week where, the Member of the Scottish Parliament (MSP) invited him to a sports event and dinner.

The leader of the Conservative Party in Scotland Jackson Carlaw said the actions "could constitute the grooming of young individual," adding it was time for Mackay to stand down from Parliament completely.

Mackay, often tipped to succeed Scotland First Minister Nicola Sturgeon, said in a resignation letter that he has apologized to the boy and his family, stating that he had "behaved foolishly."

Sturgeon said Thursday that she had accepted Mackay's resignation.

"Derek has made a significant contribution to government, however he recognizes that his behavior has failed to meet the standards required," said the Scottish National Party (SNP) leader.

Mackay was due to deliver his budget speech in the Scottish Parliament on Thursday afternoon. The £43 billion ($55 billion) budget will now be presented by the public finance minister, Kate Forbes.

The SNP has led the devolved government in Scotland for 13 years, continuously pressing the need for Scottish independence from the United Kingdom.

The party's former leader, Alex Salmond, is due to stand trial next month on allegations of sexual assault and rape. The party has suffered criticism over education and health standards at some hospitals, but has sustained remarkable popularity.

Recent polls suggest that support for independence has recently ticked above 50% and the party performed well in the December U.K. general election.