Prince William has told how both his happiest and saddest memories have taken place in Scotland.
The Duke of Cambridge said he was at Balmoral, the Queen's Aberdeenshire home, when he found out his mother Princess Diana had died.
Giving the opening address at the General Assembly of the Church of Scotland, the duke revealed how he found comfort and solace in the Scottish countryside in those "dark days of grief" in 1997.
But he also said Scotland is where he met his wife 20 years ago while they were at the University of St Andrews, which he said was a memory of "great joy".
The Queen appointed William as Lord High Commissioner to the assembly, which is taking part mainly online with a small number of people at Edinburgh's Assembly Hall.
He said: "Scotland is a source of some of my happiest memories but also my saddest.
"I was in Balmoral when I was told that my mother had died. Still in shock, I found sanctuary in the service at Crathie Kirk that very morning and in the dark days of grief that followed I found comfort and solace in the Scottish outdoors.
"As a result, the connection I feel to Scotland will forever run deep.
"Alongside this painful memory is one of great joy because it was here in Scotland 20 years ago this year that I first met Catherine.
"Needless to say the town where you meet your future wife holds a very special place in your heart.
"George, Charlotte and Louis already know how dear Scotland is to both of us and they are starting to build their own happy memories here too."
Talking about St Andrews, he said he spent four "very happy and formative years" there with the town and students leaving him alone "to get on with student life, allowing me to share their freedoms - and their pubs".
"Scotland is incredibly important to me and will always have a special place in my heart.
"I've been coming to Scotland since I was a small boy.
"As I grew up I saw how my grandmother relishes every minute she spends here and my father is never happier than in walking among the hills.
"My childhood was full of holidays having fun in the fresh air, swimming in lochs, family barbecues with my grandfather in command, and yes the odd midge."
Over the next few days, the assembly will consider several issues, including proposals to reduce the number of presbyteries and the number of full-time ministry posts.
William began a week-long visit to Scotland on Friday, with the Duchess of Cambridge joining him on Monday.