The Duke of Cambridge has said Scotland is the source of his saddest and happiest memories.
Prince William recalled being at the Queen's Balmoral home in 1997 when he first learned of his mother's death.
He found comfort and solace in the countryside there during the "dark days of grief," he said in a speech to the Church of Scotland on Saturday.
But he said Scotland was also where he first met his wife almost 20 years ago.
"The connection I feel to Scotland will forever run deep," he said, during the opening speech of the church's General Assembly in Edinburgh, attended by First Minister Nicola Sturgeon.
His comments come two days after he blamed failings at the BBC over its interview with his mother, Diana, Princess of Wales, for fuelling her paranoia and worsening his parents' relationship.
Addressing the assembly, the duke, who is also known as the Earl of Strathearn in Scotland, said: "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.
"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."
Reminiscing about his time at the University of St Andrews in Fife, where he and the Duchess of Cambridge studied, he said: "I spent four very happy and formative years studying in St Andrews. The town and the students left me alone to get on with student life, allowing me to share their freedoms - and their pubs.
"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."
During the meeting, the Rev George Whyte, chaplain-in-ordinary and principal clerk of the Church of Scotland, read out a letter from the Queen.
In the letter, she spoke of "new bonds" that have been "forged in times of emergency" that "will serve us all well in the future as the United Kingdom seeks to rebuild and reshape community life".
Meanwhile, the monarch has visited the Royal Navy aircraft carrier HMS Queen Elizabeth to wish the crew well ahead of their first operational deployment.
The £3bn warship will depart later for a world tour, carrying eight RAF F-35B stealth fighter jets, and accompanied by six Royal Navy ships, a submarine, 14 naval helicopters, a company of Royal Marines.
The Queen was welcomed on board at Portsmouth Naval Base and given a briefing on the 28-week deployment, which will cover 26,000 nautical miles.
- "I'M NOT ALONE": Hayley Pearce talks about her own experiences living with ADHD
- LIFE AFTER GRIEF: Stacey Dooley talks to parents about navigating pregnancy after losing a child