Humza Yousaf has urged people written off by bigots because of their colour, gender or background to tell them: “F*** you”.

He admitted it was an “uncomfortable message” and “not first ministerial language” but was appropriate in the circumstances.

The First Minister said he had spent most of his career having his ability questioned by “mainly white middle-aged Conservatives” who thought he didn’t belong in politics.

He told an audience at the Edinburgh Fringe that he hoped his becoming leader of the SNP and the country would inspire people of diverse backgrounds to strive for success.

Read more: Alex Salmond predicts Alba to win 24 seats at next Holyrood election

Mr Yousaf made the comments at a recording of the Political Party podcast with comedian Matt Forde at the Gilded Balloon Teviot.

The 38-year-old Glasgow Pollok MSP became First Minister in March after the resignation of Nicola Sturgeon and a tough leadership contest against Kate Forbes and Ash Regan.

Speaking about the increased diversity in Scottish politics in recent years, he said there would always be some people who would have a problem with him being a Muslim.

However, while abuse was common on social media, but didn’t come up on the doorstep or during the 19 leadership hustings.

He said: “[There was] nobody asking me, well because you’re a Muslim are you sure we can trust you? Where’s your loyalty to this country? And all that kind of nonsense.”

He said he and Scottish Labour leader Anas Sarwar were both South Asian males who had gone to private school [Hutchesons’ Grammar in Glasgow], “so we come with some privilege and you’ve got to recognise that and I think it’s really important for us to recognise that”.

He went on: “There’s still too many barriers to politics - class is one of them, I’m afraid. It’s still there. 

“How do we make politics as accessible to those that do not have the privilege that I have had growing up? 

“We have never had a single black member of the Scottish Parliament ever. “I don’t think we’ve ever had a single Jewish member of the Scottish Parliament. 

“If I’m wrong I’m happy to be corrected.

“There’s a lot of diversity that just hasn’t come through our political ranks just yet in Scotland but I genuinely hope that people can look at me.. and say, you know what, because you’ve made it it makes us feel any of us can make it, which is a bit of inspiration I hope I can give.”

Mr Yousaf went on: “This is maybe an uncomfortable message for some, but I’ve spent most of my political life being told by mainly middle-aged white Conservatives, both in politics and frankly some in the media, that I’m not smart, I’m out of my depth, essentially saying you don’t belong here in the political realm.

“And, yeah, I hope that any other person, whether it’s your colour, whether it’s your gender, or whether it’s your background, if you get told actually you don’t belong here, you should kind of look at me and say, F*** you. 

“It’s not First Ministerial language, but you should say, You know what, I do belong here. 

“Because you very much do.

“This is your country, and whatever field you’re working in you should absolutely have confidence that you’re able to achieve the highest level.”