The Church of Scotland is looking at whether it can continue to offer marriages if same-sex legislation leads to expensive court challenges.

MSPs were told there are deep concerns in the Kirk about the Marriage and Civil Partnership (Scotland) Bill currently going through Holyrood.

The Rev Alan Hamilton, convener of the Kirk's legal questions committee, said the Bill could be an "invitation" to take religious bodies 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," he told Holyrood's Equal Opportunities Committee.

"That is why the General Assembly of 2013 in May of this year instructed my committee, together with other councils and committees of the Church of Scotland, to consider whether in fact - and I'm saying this colloquially, this is not the terms of the deliverance of the General Assembly - whether it's worth the Church of Scotland continuing to offer marriages in Scotland.

"It gives us considerable problems internally; we're deeply concerned about the threat externally."

The Church of Scotland called for freedom of religious belief and practice to be respected when the Scottish Government published its proposal in June.

Religious bodies who wish to perform same-sex marriages will have to opt in, the Government said when it lodged the Bill in June. It said protection will also be in place for individual celebrants who consider such ceremonies to be contrary to their faith.

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.

Mr Hamilton said individuals or groups could end up taking religious bodies to court if they decide not to offer same-sex services.

They may be "disappointed" that a denomination or celebrant is not prepared to conduct the ceremony, he said.

The official terms of the instruction to the Kirk's legal questions committee emerged in a "remits booklet" report by the General Assembly.

It calls for the committee to "explore the possibility of ministers and deacons ceasing to act as civil registrars for the purpose of solemnizing marriages and report to the General Assembly of 2015".

The Church of Scotland later issued a statement insisting it is "business as usual".

The Kirk committee's look at the issue does not mean there are plans to stop conducting marriages.

The statement, in Mr Hamilton's name, continued: "As the largest provider of religious marriages in the country, more than 5,500 in 2012, we hold to the historical understanding held by most Christians around that world that marriage is between one man and one woman.

"As politicians consider the Bill, the Church of Scotland asks for space for itself and for its ministers to decide whether to celebrate same-sex marriages.

"We are simply urging that any legislation if approved is robust enough to protect those who in conscience will not want to conduct such ceremonies."

The Church says it agreed to look over a period of two years at the case for the practice common in other countries of all marriages being civil but couples having the option of a blessing afterwards.

Some argue it could encourage couples to make a more conscious decision to go to Church rather than treating Church as just a "particularly nice place to marry".

The Church says members also want to explore the case for services being an "optional extra" after a civil ceremony, given the "potential" for ministers to be subject to legal action following the proposed legislation on same-sex marriages

Earlier, the Rev David Robertson, Free Church minister in Dundee and director of the Solas Centre for Public Christianity, also appeared before MSPs.

Following the session, he said: "What the Scottish Government is doing with this Bill is effectively turning all marriages into civil partnerships, and therefore destroying marriage.

"We do not accept that any government has the right to redefine marriage any more than it has the right to redefine a circle as a square.

"We also believe that the Scottish Government is rushing into this without a proper understanding of the consequences of this fundamental change in society."

The committee later heard from other organisations who expressed the view that the protections offered to religious bodies in the Bill are adequate.

Rev David Coleman, convenor of the church and society committee at the National Synod of Scotland of the United Reformed Church, said: "We have become convinced that the guarantees contained within the Bill are adequate.

"From one point of view they may even seem excessive but maybe that is sufficient to guarantee they are there, and no one is forced to engage in something that they are spiritually disinclined to do.

"We are in support of things because we believe the guarantees are there."

Humanist celebrant Ross Wright, of Humanist Society Scotland, told the committee the organisation accepts the provisions in the Bill requiring organisations to opt in to performing same-sex marriage, therefore protecting religious bodies.

"It is an accommodation we are prepared to make," he said.

"It is giving freedom to discriminate, which we are not happy with. But for the sake of getting this Bill passed, we will concede it.

"People who are not registrars are given the right, not the duty, to conduct marriages. Because of that, it is a mystery to me why we even need the opt-in and opt-out clauses. But they are an additional part."