Scotland's former finance secretary, Derek Mackay, will not face criminal charges over hundreds of social media messages he sent to a 16-year-old boy.
Police Scotland said it had concluded its inquiries and "there is nothing to suggest that an offence has been committed".
A spokeswoman said anyone with further information should contact police.
Mr Mackay resigned as finance secretary over the scandal, hours before he was due to deliver the Scottish budget.
It followed claims, first published in The Scottish Sun in February, that Mr Mackay sent 270 messages to the boy over a six-month period on Instagram and Facebook.
The teenager later told the paper: "I was happy to speak to the police and will tell them everything that happened.
"I didn't think what he was doing was a crime, but I knew it was wrong and should be highlighted."
The former finance secretary repeatedly messaged the schoolboy, often trying to start a conversation even when the boy did not respond.
Mr Mackay, who is 42, contacted the boy "out of the blue" last August.
The boy told Mr Mackay he was only 16, and told him "not to try anything", but Mr Mackay continued to message him.
In a series of exchanges, the transcripts of which were published by The Scottish Sun, he told the schoolboy that he was "cute", as well as inviting him to dinner and to attend a rugby event.
The newspaper also reported that Mr Mackay contacted the boy several times on Christmas Day, and told him on another occasion that he was "looking good with that new haircut".
After the messages became public, Mr Mackay resigned from his post and released a statement apologising "unreservedly" to the boy and his family.
He added that he had "behaved foolishly" and took full responsibility for his actions.
Nicola Sturgeon later confirmed that he had been suspended by the SNP while further investigations are carried out.
Mr Mackay has not been seen in Holyrood since The Scottish Sun story was published.
A spokesman for the SNP said: "We understand Derek Mackay is currently under medical supervision. He remains suspended from the SNP."