Derek Mackay had been tipped as a possible successor to Nicola Sturgeon but he has now been forced to quit the Scottish Government after he allegedly sent hundreds of messages to a 16-year-old boy.
The 42-year-old stepped down just hours before he was due to unveil his Budget for 2020-21.
His resignation comes more than two decades after he began his career in politics, being elected as a councillor in Renfrewsire in 1999.
It made him the youngest male councillor in Scotland, having been elected at just 21.
Mr Mackay went on to become leader of the council’s SNP group, and took them into power in the area for the first time in 2007- at which point he became leader of the council.
He used his role to build a national profile within local politics, becoming the SNP group leader at Cosla – the organisation which represents Scotland’s local authorities.
In 2011 he was elected to Holyrood as MSP for Renfrewshire North and West.
That same year he joined the Scottish Government, becoming minister for local government and planning.
A reshuffle after Nicola Sturgeon became First Minister in 2014 saw him appointed transport minister.
He was further promoted to the Cabinet after the 2016 Scottish election, taking the job of Finance and Economy Secretary.
He was previously married and has two children, but in 2013 he came out as gay.
Mr Mackay later described that as the “most difficult thing I’ve ever had to deal with”.
During his time as finance secretary, he was responsible for introducing new Scottish income tax rates, including a new “starter rate” set at 19p for lower earners.