Three generations of the Royal Family gathered in Edinburgh for a special service as hundreds of onlookers lined the streets to greet them.

The Queen and Duke of Edinburgh took part in a thanksgiving service for the Order of the Thistle at St Giles' Cathedral.

They were joined at the event by their daughter the Princess Royal and grandson Prince William, known as the Earl of Strathearn in Scotland.

The event took place as the Queen continues her run of official engagements in Scotland.

A trumpet fanfare marked the start of the event as the four royals, who are members of the order themselves, arrived at the cathedral.

They joined a procession through the cathedral leading to the Thistle Chapel, a small space founded in 1911 for these ceremonies.

All were dressed for the event in the ceremonial mantles of the order.

The party was accompanied by others who hold the honour, including Lord Smith of Kelvin, Lord Steel and Lord Cullen.

They looked on as the service in the filled to capacity cathedral featured readings, hymns and prayers.

After the ceremony, the Queen was greeted by the Royal Company of Archers, her official bodyguards in Scotland, and musicians from the Royal Regiment of Scotland.

As they departed, onlookers who had crowded into the Royal Mile were rewarded with a glimpse of the royal party.

The Order of the Thistle is the greatest order of chivalry in Scotland.

It honours Scottish men and women who have held public office or contributed in a particular way to public life. The date of its foundation is not known.

Earlier this year, the Thistle Chapel reopened to the public after a spate of thefts forced its closure for more than a year.