Diamond Jubilee: Prince William attends Order of the Thistle ceremony
Prince William has been installed as a Knight of the Order of the Thistle, the highest honour available in Scotland.
The ceremony at St Giles Cathedral in Edinburgh was followed by a parade down the Royal Mile led by 400 pipers.
The ancient Order of the Thistle can only be bestowed by the Queen herself.
There are currently 16 knights in the order, including Prince William's grandfather, Prince Phillip, his father, Prince Charles, and his aunt, the Princess Royal.
The event - on the fourth day of the Queen's jubilee celebrations in Scotland - is the latest in a series of engagements the monarch is undertaking to mark her 60 years on the throne.
During the short ceremony, the Queen said to her grandson: "It is our pleasure that his Royal Highness the Prince William, Earl of Strathearn, be installed a Knight of the most ancient and most noble Order of the Thistle."
Prince William then moved to a vacant stall within the Thistle chapel of St Giles' before taking an oath.
He promised to be "loyal and true to my Sovereign Lady the Queen, and the members of this Order".
He said: "I shall maintain the honour and dignity of the most ancient and most noble Order of the Thistle to the best power if God let.
"I shall never bear treason about in my heart against our Sovereign Lady the Queen, but shall discover the same to her. So defend me God."
The 30-year-old Prince was accompanied by his wife Kate, the Countess of Strathearn.
The others attending the ceremony included Prince Phillip, Princess Anne and the non-royal members of the order, including the former Liberal leader Lord Steel and the former defence secretary Lord Robertson.
The event was followed by a procession involving pipers, drummers and dancers, travelling down the Royal Mile to the Scottish Parliament building.
The Queen is traditionally in Scotland for Royal Week, but this year it has incorporated celebrations of the Diamond Jubilee.
The monarch has already attended events in Edinburgh and Glasgow, and on Friday she and the Duke of Edinburgh will visit Perth, which was awarded city status to mark the jubilee.