An SNP activist has resigned his membership in protest at the "undemocratic" decision by Alex Salmond's cabinet to push ahead with same-sex marriage legislation despite opposition in a public consultation.

Robert Stewart, 66, a member for 22 years, was secretary of the Skye, Lochaber and Badenoch constituency association.

"SNP members have never been consulted as members. There is no party policy on the matter. National conference have not discussed the issue," he said.

"It is not an SNP manifesto commitment and I simply cannot understand how the SNP have a democratic mandate either from the party or from the nation to make such a fundamental change to a centuries-old institution.

"In short, I find the decision undemocratic."

On July 25 Deputy First Minister Nicola Sturgeon said that legalising gay marriage is "the right thing to do".

She pledged to bring forward a Bill at Holyrood which could see the first same-sex marriages take place at the start of 2015.

This followed a Scottish Government consultation which generated 77,508 responses, 81% of which came from people living in Scotland. Of those, 36% are in favour of same-sex marriage and 64% against. When responses such as postcards and petitions are excluded, the result is reversed, with 65% in favour and 35% against.

Mr Stewart, from Glen Urquhart in Inverness-shire, said he has resigned not in protest at the policy but in response to the way the decision was handled by leaders, which he feared could become an "elected dictatorship".

He said: "I am not a church person, am not married to the person I live with and been divorced twice. Some people might call me a hypocrite. But this is all about democracy and proper consultation, and that has not happened.

"I'm a great believer in grassroots democracy and not elected dictatorships. I had always believed the SNP was the only party that listened to people and I was besotted with the party, but this decision has come as a great shock to me and I'm finding it hard to get my head round what is happening.

"I believe the move is a needless distraction before the referendum on independence and will cost the SNP votes from evangelical Christians, Roman Catholics and Muslims."

A "curt" reply was sent to him by party chief executive Peter Murrell - Ms Sturgeon's husband - after he tendered his resignation.

Mr Stewart added: "There was no attempt to reason with me after 22 years of service. I felt offended by that after so long in the front line."