Patrick Harvie, the leader of the Scottish Green Party, says he has endured anti-gay jokes from parliament colleagues.

Speaking to Scotland on Sunday, the 38-year-old, who is bisexual, said he knew some MSPs had made “homophobic” remarks about him behind his back.

He said: “I’m aware of homophobic comments being made about me by some politicians, albeit not to my face,

“However, I think we’ve reached a point where people who hold ideas like that know they need to shut up and realise they won’t make any friends by voicing those kinds of opinions.”

When asked for more detail, Mr Harvie said: “I would certainly say it’s not something I’ve experienced from most [MSPs] and it’s probably at the level of what might be regarded as banter, but when it comes to jokes about race, people know that’s unacceptable.”

He said he had “occasionally” heard jokes about his sexual orientation in Holyrood.

“It’s certainly on balance a very supportive workplace, but any group of 129 people is going to include a range of views and values,” he said.

“The most important point is that it is a lot less hostile than a lot of workplaces and a lot less hostile than politics used to be. The main thing is that we have come a very long way.

“We’re a lot closer to an inclusive and equal society, but we’re not there yet, and there are still areas where you’ll find a bit of ignorance or a bit of prejudice.”

Mr Harvie, who was elected in 2003, is the MSP for Glasgow.

He made history in 2008 when he became the UK’s first LGBT political party leader.