King Charles takes part in Ceremony of the Keys in Edinburgh as Holyrood Week begins

The King has begun his official stay in Scotland by receiving the keys to the city of Edinburgh - which is celebrating its 900th anniversary.

The monarch took part in the Ceremony of the Keys in the garden of the Palace of Holyroodhouse, his official residence in the Scottish capital.

He was welcomed by the lord provost, city councillor Robert Aldridge, after arriving by helicopter with the Queen.

Mr Aldridge presented the keys on a red velvet cushion, which the King symbolically touched.

The councillor said: "We, the lord provost and members of the City of Edinburgh Council, welcome Your Majesty to the capital city of your ancient and hereditary kingdom of Scotland and offer for your gracious acceptance the keys of Your Majesty's good city of Edinburgh."

The King responded with the traditional reply: "I return these keys perfectly convinced that they cannot be placed in better hands than those of the lord provost and councillors of my good city of Edinburgh."

Ahead of the ceremony, the palace's garden was transformed into a parade ground, where the King met senior military and uniformed figures including Police Scotland Chief Constable Jo Farrell, before receiving a royal salute and inspecting a guard of honour of soldiers from Balaklava Company, 5 Scots.

Also lined up were the Royal Company of Archers, who serve as the sovereign's ceremonial bodyguard for Scotland - a role first created in 1822 for King George VI.

The Band of the Royal Regiment of Scotland and the Pipes and Drums of 2nd Battalion Royal Regiment of Scotland were on parade for the occasion.

The King walked past the guard of honour, casting his eye over the servicemen and stopping to talk to some of them. He also spoke to members of the military bands.

An investiture ceremony also took place on Tuesday, where author Sir Alexander McCall Smith was knighted.

The writer and creator of The No. 1 Ladies' Detective Agency series was honoured for services to literature, academia, and charity.

Speaking after the ceremony, the 75-year-old author said: "It's a wonderful thing, I'm most grateful, it's a very nice thing to happen so I'm very pleased, but of course obviously behind it there are all sorts of other people who have made it happen so I think of them."

Read more from Sky News:
New portrait of King released
King hosts lavish state banquet for Japan's emperor

The King and Queen will round off the trip to Scotland with a celebration at Edinburgh Castle to mark the city's 900th anniversary.

Each year, the monarch traditionally spends a week based at the Palace of Holyroodhouse, known as Holyrood Week or Royal Week in Scotland.

This year's is shorter than in previous years because the general election has meant the Royal Family has postponed any engagements "which may appear to divert attention or distract from the election campaign".

The King will also be needed for the formal processes in the aftermath of the election, such as the appointment of a government - with the leader of the party that wins a general election usually called to Buckingham Palace following the result.