THREE generations of the Royal Family have been represented at a special service in Edinburgh - 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 the city's St Giles' Cathedral.

They were joined at the event by their daughter the Princess Royal and grandson the Duke of Cambridge, who is known in Scotland as the Earl of Strathearn.

READ MORE: Prince Harry makes HIV/AIDS testing plea in virus awareness drive at Kings College Hospital

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 full-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.

The Herald:

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

READ MORE: Prince Harry makes HIV/AIDS testing plea in virus awareness drive at Kings College Hospital

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.