The Queen has called on people of faith and goodwill to work together for the social good of Scotland whatever the outcome of the independence referendum.

The Queen recognised the roll of the kirk in "holding the people of Scotland together" and "healing divisions" in a letter to the Church of Scotland general assembly.

The letter was presented to the opening session of the assembly in Edinburgh this morning, in the presence of Prince Edward and First Minister Alex Salmond.

Prince Edward gave an address on the theme of community, and The First Minister welcomed The Queen's "typically gracious and considered remarks" in a published statement.

The Queen said: "Throughout the history of Scotland, the Church of Scotland has played a key part in shaping the governance of Scotland and Scottish society.

"We recognise that contained within the articles declaratory of the Church of Scotland, church and state hold mutual duties towards one another.

"So in this important year of referendum we pray that whatever the outcome, people of faith and people of goodwill will work together for the social good of Scotland.

"We recognise too the important role that the church can play in holding the people of Scotland together, in healing divisions and in safeguarding the interests of the most vulnerable.

"In this year in which Scotland will host the Commonwealth Games in Glasgow, we commend to you those who will come from around the world as competitors and spectators.

"We are confident that the church will play its full part in welcoming, supporting and extending the hand of friendship to the diverse peoples of the Commonwealth.

"This year the First World War will be remembered, when people around the world are called to commemorate the valour, courage and sacrifice of so many who gave their lives in the many battles that scarred Europe from 1914 to 1918.

"As well as being a time of commemoration, we believe that it is a time to pray for the peacemakers of the world, and for a day when nations shall live at peace with one another."

Mr Salmond said: "These are typically gracious and considered remarks from Her Majesty the Queen in which she extends a warm welcome to people from around the world to come and enjoy the Commonwealth Games in Glasgow.

"Her Majesty is also right to highlight the importance of everyone working together for the social good of Scotland, regardless of the outcome of the referendum, which is something I heartily endorse and should be welcomed across the political spectrum.

"Her remarks on the First World War commemoration as a time for rededication to peace were well chosen, as indeed was her praise of the interfaith initiative on credit unions - a practical initiative in which the Church of Scotland is fulfilling its mission to the vulnerable in society."

Prince Edward said: "Community is about looking out for each other, but how can we do this as many of our communities become larger and less personal.

"The state has developed all sorts of ways and means and we have devised ever more sophisticated legal systems and processes, but in doing so are we creating a more harmonious society?

"In my mind there is a significant difference between the assertion of legalistic rights versus the Christian teaching of responsibility.

"For instance, I could argue that it's my right to play my music as loudly as I please. However, this is bound to infringe someone else's right to peace and quiet.

"There is no clear answer to this, so we could come to blows or it requires going to court and engaging two lawyers going to court and arguing the case.

"One of us will be happy and the other unhappy. We will both probably have had our characters besmirched and our lawyers will be, well, better off.

"However, as a Christian I am taught to consider others and in this case the likely impact of playing my music too loudly.

"Maybe this was just the way I was brought up, but I can't help questioning which creates a more harmonious society - the individual demanding their right which will ultimately lead to conflict or the individual being aware of their responsibility and acting accordingly?"

The new moderator of the general assembly described his appointment this morning as a "humbling and uplifting" experience.

The Right Rev John Chalmers received the millennium cross and ring from Very Rev Lorna Hood as he was installed as the 86th moderator of the modern era.

"There was an extraordinary sense in which the whole church is behind you," Mr Chalmers said.

"It is both humbling and uplifting at one and the same time. It will be a very special year ahead."

During general assembly week, this annual gathering of the Church of Scotland will make decisions on matters of church policy and governance.

The issues will be debated by around 730 Commissioners drawn from congregations across Scotland and beyond.

Decisions made can have an historic and long-standing impact on the future of the national church.

A referendum debate will be held on Tuesday afternoon, in which the assembly will hear from four speakers before the session is opened for contributions.

Author and lecturer the Rev Dr Doug Gay of Glasgow University will speak for the Yes campaign, and Labour MP Douglas Alexander will propose his views on the Better Together campaign.

Former Moderator of the General Assembly, Alison Elliot OBE, will pose some of the questions facing undecided voters and John Sturrock QC, a proponent of the need for respectful dialogue on Scotland's future, will round up the debate.