Queen urges calm in 'challenging world'
The Queen has acknowledged the difficulty of "staying calm and collected" in an "increasingly challenging world".
The monarch was speaking as she formally opened the fifth session of the Scottish Parliament.
She stressed the need for political leaders to make "room for quiet thinking and contemplation".
It was her first major address since the UK voted for Brexit in last month's referendum.
The result has ignited calls for a new referendum on Scottish independence, with Scotland facing the prospect of having to leave the European Union despite voting by 62% to 38% in favour of remaining.
- Look back at the BBC's coverage of the parliamentary opening
- Brian Taylor on the Queen's 'keep calm and carry on' message
- In pictures: The opening ceremony of the Scottish Parliament
The Queen told the Holyrood chamber that the world was "increasingly complex and demanding" and that developments can take place at "remarkable speed".
She added: "Retaining the ability to stay calm and collected can at times be hard.
"As this parliament has successfully demonstrated over the years, one hallmark of leadership in such a fast-moving world is allowing sufficient room for which can enable deeper consideration of how challenges and opportunities can be best addressed."
The chamber also heard from Scotland's first minister, Nicola Sturgeon, who said MSPs had been given the "precious opportunity to contribute to building a better country - and build it we will".
Ms Sturgeon added: "To do so we must be bold and ambitious. We must show courage and determination. Our collective commitment to the people of Scotland today is that we will not shy away from any challenge we face, no matter how difficult or deep-rooted."
Analysis by Brian Taylor, BBC Scotland political editor
If you are the first minister, you can make your point directly. And so Nicola Sturgeon concluded her remarks at Holyrood today by urging MSPs and Scotland more generally "to play our part in a stronger Europe and a better world."
If you are the presiding officer, you can say what you mean to say, without challenge. And so Ken Macintosh, in a notably well-structured speech, urged optimism in these troubled and uncertain times.
However, if you are Her Majesty the Queen, you have to be more circumspect. The palace reacted furiously when one newspaper purported to know the views of the monarch upon the EU referendum question.
Further, although she is the sovereign, she operates within a careful power balance in which she is not supposed to interfere in decisions taken by elected representatives.
Did she interfere today? She did not. Did she, however, contrive to convey an overview upon the events of the past week? She did, albeit in the context of urging calm, cool heads.
The first minister, who has pledged to do all she can to maintain Scotland's place in the EU, also spoke of the parliament's duty to "enhance and never diminish our place in the world", and said Scotland was determined to remain "open and inclusive".
She said: "Whether we have lived here for generations or are new Scots, from Europe, India, Pakistan, Africa and countries across the globe we are all of this and more. We are so much stronger for the diversity that shapes us.
"We are one Scotland and we are simply home to all of those who have chosen to live here, that is who and what we are."
She added: "Today, as we celebrate this new beginning, let us look forward with hope and a shared determination to work tirelessly for the good of all of Scotland's people - and in doing so, to play our part in a stronger Europe and a better world."
The opening ceremony also included music, poetry and speeches, with about 2,500 people scheduled to take part in the historic Riding Procession down the Royal Mile following the event.
A series of free events and a family fun day were then due to be staged around the Holyrood campus.
The Queen arrived at the parliament shortly after 11:00, when she was welcomed by Presiding Officer Ken Macintosh and introduced to the leaders of Holyrood's five political parties, including Ms Sturgeon.
Mr Macintosh told Her Majesty that the parliament "stands ready for the challenges that lie ahead of us" and that "every MSP in this chamber is proud to represent the people of Scotland."
The presiding officer added: "In these few short weeks, weeks of unprecedented political turbulence, I have already seen a real willingness to work cooperatively and collaboratively.
"I have seen the emergence of a shared agenda to clarify the identity and role of the Scottish Parliament and a shared recognition that it is more important than ever that the parliament finds its own voice - a voice of hope, to echo Donald Dewar, a voice for the future."
Poems by Edwin Morgan and the Scots Makar, Jackie Kay, were read out, with musicians from the National Youth Choir of Scotland also performing and singer Midge Ure giving a rendition of Robert Burns' A Man's A Man For A' That.
MSP Stuart McMillan played The Rowan Tree on the bagpipes as Her Majesty left the chamber.
The fifth term of the Scottish Parliament began after May's Holyrood elections, and MSPs had their final session before the summer break on Thursday.
Following the opening ceremony, thousands of people took part in the Riding procession down the Royal Mile, led by the Band of the Royal Regiment of Scotland.
Community groups including Shetland Vikings, Polish Punjabi and Highland dancers, pipe and brass bands, choirs and a martial arts group manning a Chinese dragon also made their way down the road and into Holyrood's grounds.
Local heroes nominated by MSPs in recognition of their work for local causes joined the Riding as it approached Holyrood, along with elected representatives and guests.
A "Big Day Out" event will be held between 14:00 and 18:00, inside and out of the parliament, including singing, dancing, arts and crafts, falconry and beekeeping.