The 39-year-old said it had been “an honour and privilege” to hold the top job in Scottish politics.
He said his heart would “forever belong to Scotland” as he told how leading his country had given him the opportunity to defy racism.
As both the youngest person to take on the job and the first person of colour to be First Minister of Scotland, Mr Yousaf said he had had opportunities he could “only have imagined in his wildest dreams”.
READ MORE: Humza Yousaf: From call centre worker to First Minister
Speaking from Holyrood’s front bench for the final time, he told MSPs about the racial abuse he had suffered since a young age.
He said: “Young Humza Yousaf could never have imagined he would be able to lead this country.
“I was six years old when I was first told to go home, and I am afraid since then it has been a regular occurrence – in fact, almost daily if you look at my social media feeds.”
He said that “racial slur” had hurt him most “simply because I have no other home than this one, I never will, I never have”.
Mr Yousaf continued: “My heart will forever belong to Scotland.
“So to have the opportunity to defy the far right, to defy the racist bigots who told me to go home, to be in a position to serve my home, to contribute to public life in my home, and to have the opportunity to lead my home – that has been the most tremendous honour that I didn’t think was reserved for people who looked like me.”
His comments came as he addressed MSPs after formally tendering his resignation as Scottish First Minister – a post he took on just over 13 months ago.
He went on to hail new SNP leader John Swinney – who will likely succeed him as Scotland’s next first minister – as being “one of the most empathetic, kind, compassionate people” he had known.
The departing leader added: “Such qualities are crucial in life, they are absolutely necessary as First Minister.”
Mr Yousaf had announced his intention to resign last week, after he ended the power sharing deal between the SNP and the Scottish Greens at Holyrood, provoking a furious response from the smaller pro-independence party.
That saw him facing a motion of confidence in his leadership that he was unlikely to win, forcing him to step down from the post.