HUMZA Yousaf has attacked his main rival in the SNP leadership race, saying he would never use his faith “as a basis of legislation”.

The Health Secretary took the swipe at Kate Forbes after she said wouldn’t have voted for gay marriage as a matter of conscience and doesn’t support Holyrood’s controversial gender reforms.

Ms Forbes, a devout member of the Free Church of Scotland, also said she wouldn’t challenge the UK Government’s veto of the gender reform legislation.

The war of words coincided with the Scottish Greens weighing into the SNP leadership race by aligning themselves with Mr Yousaf’s position. 

The junior partner in the Scottish Government said the next first minister must pursue a legal challenge against the UK Government to ensure the reforms go ahead.

“Not to do so would set a very damaging precedent and would be incompatible with any belief in Scotland's right to self-government," the Greens said.

Ms Forbes, the bookies’ favourite to replace Nicola Sturgeon, told the BBC she did not believe people should be allowed to change gender on the basis of self-declaration alone.

She said that she would not go to court to challenge the UK government’s Section 35 order veto on the Gender Recognition Reform Bill.

In a clear dig at Ms Forbes, Mr Yousaf later told Andrew Marr on LBC that although he was a proud Muslim, “what I don’t do is, I don’t use my faith as a basis of legislation”.

Mr Yousaf voted in favour of the general principles of the Marriage and Civil Partnership (Scotland) Bill in November 2013, but did not vote on its third and final stage in February 2014.

MSPs passed the GRR Bill before Christmas, but last month the UK Government stopped it from becoming law because of a possible clash with UK-wide equality law.

The Bill was intended to simplify the process for changing sex in the eyes of the law, ending the need for a medical diagnosis in favour of self-ID. 

Advocates said the change would end a system that was cruel to transgender people, while opponents said it created a system that could help male predators carry out abuse.

After the UK Government vetoed the Bill, Nicola Sturgeon said it was an attack on Holyrood’s democratic legitimacy and a judicial review was all but inevitable.

However both Ms Forbes and former minister Ash Regan, who are standing for the SNP leadership, are opposed to the GRR Bill and would not challenge the S35 Order.

Only Mr Yousaf today said he would pick up where Ms Sturgeon left off, saying: “I think we should absolutely be challenging that in court.” 

He also told Andrew Marr it would be “disastrous” to end the Bute House Agreement, the co-operation deal between the Scottish Government and the Scottish Greens.

Because the GRR Bill is so important to the Greens, the deal would be at risk if Ms Forbes or Ms Regan abandoned the gender legislation.

Warning a split would damage the independence movement, Mr Yousaf said: “I'm a wholehearted supporter of that deal, because it's brought stability to the government. 

“I think in a time when we have so much political discord, the fact that two political parties who yes have some differences in policy are able to come together to compromise, find an agreement to govern in the best interest of the country, that's a good thing. 

“But frankly speaking, it would do enormous damage to the independence movement, if we had two parties that were working well together, split up, have that divorce, frankly, and that's not going to go down well for anybody.

“I think the Green deal has been great for not just for the government, but actually we've brought forward some really radical reforms. So, I'm a great supporter of it.”

He added: "I'm a supporter of equal marriage.

"Let me get to the crux of the issue that you're asking me.

"I'm a Muslim. I'm somebody who's proud of my faith. I'll be fasting during Ramadan in a few weeks’ time.

"But what I don't do is, I don't use my faith as a basis of legislation.

"What I do as a representative, as a leader, as a Member of the Scottish Parliament is my job is to bring forward policy and pursue it in the best interest of the country.’

In a statement reaffirmed their commitment to delivering the Bute House Agreement, the Greens said: “Eighteen months ago the Scottish Greens agreed to join the Scottish Government under the terms of the Bute House Agreement. 

“It is a positive and progressive deal that was scrutinised and overwhelmingly endorsed by the membership and politicians of both parties, along with the full Cabinet.

“We are committed to working in cooperation with the SNP to ensure that it is delivered in full on behalf of the people of Scotland, including the Gender Recognition Reform Bill. 

“The UK Government's decision to veto this clearly devolved Bill is an abuse of their power.  As long term allies of the trans community, the Scottish Greens agree with the First Minister that this decision must be challenged robustly. 

“Not to do so would set a very damaging precedent and would be incompatible with any belief in Scotland's right to self-government."