The Church of Scotland has told MSPs it could stop performing weddings altogether over fears that same-sex marriages might be an “invitation” to future court action.

The Scottish National Party (SNP) is currently in the process of pushing same-sex marriage legislation through the Scottish Parliament where it has cross party support.

Under the plans religious bodies would have to opt into performing same-sex marriage ceremonies.

On Thursday however, Reverend Alan Hamilton of the Church of Scotland’s legal questions committee told MSPs that opt-in same-sex marriages would “fundamentally change” the nature of marriage in Scottish culture.

He said: “We’re also concerned that this is an invitation to take religious bodies in particular through the court system.

“We are voluntary bodies. We rely upon the donations of our members, and the thought of years of exhausting legal challenge, which is also incredibly expensive, is really very concerning.”

Mr Hamilton appeared before the committee with representatives of the Scottish Council of Jewish Communities, the Free Church of Scotland, the Scottish Episcopal Church and lobby group Scotland for Marriage, who all have concerns about the Bill.

Rev Hamilton said his committee and others have been asked to investigate the issue by the Church’s general Assembly.

They are to consider “whether it’s worth the Church of Scotland continuing to offer marriages in Scotland.”

He added: “It gives us considerable problems internally and we’re deeply concerned about the threat externally.”

Mr Hamilton said the “threat” could be alleviated if the State simply “recognised” Church marriages as separate stand-alone bodies. He said his main concern is that churches are seen as “agents of the state.”

He added: “Nevertheless even with this innovation we have deep concerns that when challenged this will all unravel and there’s plenty of high level legal opinion to that effect.”

MSPs were also told the proposed Marriage and Civil partnership (Scotland) Bill cannot be “seen in isolation” and challenges could come through the Equality Act at Westminster and the European Convention on Human Rights.

The Scottish Parliament held its first evidence session on the Marriage and Civil Partnership (Scotland) Bill last week.

The inquiry into the Bill is being undertaken by the Scottish Parliament’s Equal Opportunities Committee who will hear evidence from a wide range of stakeholders in the coming weeks, before making recommendations to the Scottish Parliament on whether to proceed with the Bill and, if so, in what form.

Last month, The Free Church of Scotland, who are opposed to equal marriage, called on the Scottish Government to include a conscience clause giving greater protections to celebrants who disagree with marrying same-sex couples.