Prince Philip's close association with Scotland started in his school days and lasted more than 80 years.
According to his headmaster's report, the prince was universally trusted and liked at Gordonstoun school in the north east of Scotland.
The future Duke of Edinburgh attended the boarding school in Moray until 1939.
In the early 1930s, Prince Philip of Greece, as he then was, had attended Salem School in Germany.
It was founded by Dr Kurt Hahn, a German Jew who was a famous educational innovator. The school focused on military discipline and physical education, as well as academia.
However, Dr Hahn fled Germany after he was arrested for speaking out against Hitler. He established Gordonstoun as the British version of Salem - and Prince Philip followed him there two terms later.
"The school played an enormous part in both his early life, and also his way of life," said James Thomas, from Gordonstoun.
"His enthusiasm for the school came through. When he came through Gordonstoun's gates, people generally said he had a spring in his step and he was delighted to get back and visit old haunts.
"He was always entirely relaxed whenever he came."
Prince Philip loved his time at Gordonstoun. He excelled at sport, captaining the hockey and cricket teams, and also served as head of school.
In fact, he found the regime so invigorating that he later sent his three sons - although Prince Charles did not share his father's enthusiasm for the austere establishment, describing it as "absolute hell".
Prince Philip became the Duke of Edinburgh on the eve of his wedding to Princess Elizabeth, on 20 November 1947. It is a title which had been conferred upon members of the British royal family only four times since its creation in 1726.
The future Queen Elizabeth was known as the Duchess of Edinburgh until she became queen in 1952.
The Balmoral estate in Royal Deeside provided a haven for the Queen and her consort through the decades, and the family holidayed there every summer.
The Queen is said to have described it as "my dear paradise in the Highlands".
In 1956, not long after the royal couple married, Prince Philip launched the Duke of Edinburgh's Award, inspired by the Moray Badge which he had worked for while a pupil at Gordonstoun.
Dr Hahn had started the scheme, aimed at giving post-war youngsters in Britain a sense of achievement, and he approached one of his first and most famous Gordonstoun pupils for help in rolling it out across the country.
Together he and Prince Philip drew up an outline of what would become the Duke of Edinburgh's Award, which more than four million people from some 60 countries have taken part in since its inception.
Janet Shepherd, the former head of the award scheme in Scotland, said the Prince's presentations to thousands of Scottish youngsters were an annual ritual at the Palace of Holyrood in Edinburgh.
"I would often spend the whole day with him," she said.
"You always were a bit nervous on the day, no matter how many times you did it. But he soon put you at ease. I never found him difficult or awkward.
"He was always very interested in what the young people were doing. There was always laughter and a tremendous warmth."
Prince Philip had a close involvement with the city whose title he bears. He spent 57 years as Chancellor of Edinburgh University, a role he only retired from in 2010.
The university's former principal, Prof Timothy O'Shea, said the prince was an unforgettable character who made a tremendous contribution.
"He was very actively involved in the university," he said.
"He presided at special graduation ceremonies, he would help me induct the new professors, he came along for senior staff getting long service awards. He even came to the installation of the rector by the students."
Prof O'Shea said Prince Philip liked "a certain amount of student wildness".
"He was reminiscing with me about riotous installations of the rector, with students throwing flour and doing all sorts of things," he recalled.
"He asked me when the next one was and I said I would let him know. The administration and other colleagues said you mustn't tell him, but I felt honour-bound to.
"He immediately, despite attempts from the Special Branch, insisted he came along for some uproar.
"In the event it was quite mild. And he remonstrated with me afterwards, that I'd made it too orderly."
Prof O'Shea said the prince was very straight-talking, humorous and would often tease him.
It was a trait for which he was well known, having famously asked a driving instructor in Oban how he "managed to keep the natives off the booze long enough to pass the test".
The principal said he would be greatly missed by the university community and by the city as a whole.
"When I started he explained to me that he'd been the chancellor for more than 50 years and if I had any problems I should tell him.
"He was a part of the city's life in the way the Lord Provost is part of the city's life.
"He was very jolly - meals with the chancellor were always great fun. He was a visible, positive presence."