Media playback is unsupported on your device Media caption The Queen: "It [Holyrood] must also be a place to listen a place to hear views that inevitably may differ quite considerably."

The Queen has spoken of her "great affection for Scotland" while marking Holyrood's 20th anniversary.

A ceremony took place two decades on from the Scottish Parliament taking on its legal powers.

The Queen told MSPs that she "fondly remembered" opening the parliament, and said that it "continues to be at the centre of Scottish public life".

First Minister Nicola Sturgeon told the monarch that MSPs were "united by our desire to do our best for the people".

The Queen, who was accompanied by Prince Charles, the Duke of Rothesay, spoke to each of Holyrood's party leaders personally as well as addressing them in the debating chamber.

The ceremony also featured performances of music, poetry and song celebrating Scottish culture.

The modern parliament was set up two years after Scotland voted overwhelmingly for devolution in a referendum in 1997. It initially sat at the General Assembly in Edinburgh before moving to its £431m purpose-built home at Holyrood in 2004.

The Queen was last in the landmark building in July 2016, marking the opening of the fifth session of the parliament.

She told MSPs that it was with "great pleasure" that she had been present at each stage of the parliament's lifetime, "including on landmark occasions such as today".

She said: "Twenty years on, this chamber continues to be at the centre of Scottish public life, as an important forum to engage and unite diverse communities and also a home for passionate debate and discussion.

"Through new initiatives you continue to strive to be responsive and accountable to the people you serve, and to engage and involve those who might not otherwise participate in political debate."

Image copyright Reuters / pool Image caption Nicola Sturgeon and other party leaders responded to the Queen's speech

The Queen also said it was her "sincere hope" that MSPs would "work tirelessly to improve people's lives and strengthen the bonds of friendship and partnership both at home and abroad".

In response, Ms Sturgeon said the parliament may only be 20 years old, but "has long come of age".

She said there had been times in the early years when "the sense of challenge possibly outweighed the sense of optimism", but said the hopes expressed for Holyrood in 1999 "to a great extent have been vindicated".

And she said that while politics can seem "more divided than ever", parties "can maintain our commitment to working together in the common good", saying even political opponents are "united by our desire to do our best for the people".

Other party leaders also addressed the special occasion, with Scottish Conservatives leader Ruth Davidson saying that Holyrood was "knitted into the fabric of our society", adding that "there is consensus that as a process, devolution has made our country stronger".

Birthday party

Young people who were born on the day the devolved parliament was convened on 1 July 1999 were also part of the celebrations.

The so-called "1 July babies" were also an integral part of the 10th anniversary celebrations in 2009.

Presiding Officer Ken Maintosh told them that "you carry with you all our dreams, all our ambitions and all our hopes for the future".

Image copyright PA Media Image caption Young people born on the day the parliament was reconvened were part of the celebrations at Holyrood

The Queen was preceded into the chamber by the mace and Crown of Scotland, while a fanfare was played by the brass ensemble from the Royal Conservatoire of Scotland.

The ceremony included performances by the National Youth Choir of Scotland, singer Karen Matheson and a band fronted by folk musician Phil Cunningham.

Scots Makar Jackie Kay performed a poem about the lifetime of the parliament titled "The Long View", which included sections in Gaelic and British Sign Language.

And the monarch was piped out of the chamber by MSP Stuart McMillan, with members then joining in to sing "A Man's a Man for a' That" by Robert Burns.

The Queen signed the parliament's guest book and was presented with a bouquet of flowers by 13-year-old Ewan Carmichael, before she was driven back across the road to Holyrood Palace.