The new King has offered his "warmest congratulations" to Scotland's newest city as he said conferring the honour on Dunfermline in Fife would "gladden my dear mother's heart".
King Charles III spoke as he formally conferred city status on the former town which was one of eight communities awarded the honour as part of the late Queen's Platinum Jubilee celebrations. The ceremony was the first undertaken by the King and Queen Consort after the official period of royal mourning for the Queen ended.
In a ceremony at Dunfermline City Chambers Charles said he had been "delighted" when the announcement of city status was made in May.
He spoke of his mother's "deep love for Scotland", describing it as "one of the foundations of her life".
The King highlighted the new city's "immense significance" in Scottish history as the birthplace of entrepreneur and philanthropist Andrew Carnegie.
Dunfermline is also the "burial place of kings and queens", he noted, with Robert the Bruce, who led Scotland in a war against England in the 1300s, buried in the abbey there.
The new King also spoke of the community, adding: "It is my hope that all those who live in, or who hail from, this very special place will feel a real sense of pride at this latest chapter in our rich history, and that this new distinction will not merely burnish the legacy of the past but will also brighten the prospect of our future.
"That would, I know, gladden my dear mother's heart, as it certainly gladdens mine."
Hundreds of locals turned out to greet the royal couple, with Charles telling them: "As you celebrate your well-deserved status as Scotland's new city, I can only offer my warmest congratulations, and my heartfelt wishes for the years to come."
Before the ceremony, the King and Queen Consort were greeted by a party including Fife provost Jim Leishman,
First Minister Nicola Sturgeon and Scottish Secretary Alister Jack. The provost spoke shortly before the King at the city chambers.
Mr Leishman, who is well-known in the town from his time as manager of Dunfermline Athletic, said: "Dunfermline has a special place in my heart and as the provost of the Kingdom of Fife I couldn't be prouder to receive this honour.
"To have it presented by His Majesty King Charles, so early in his reign, is indeed a privilege."
During her speech, Ms Sturgeon said she had family in Dunfermline, including her nephew who is a passionate supporter of its football team. She said: "There's no doubt that the conferring of city status is a significant moment for Dunfermline. But today is special for another reason.
"Your Majesties, we are deeply honoured to welcome you here on your first official joint visit to Scotland. It will ensure that an ancient capital of Scotland, long regarded as a city by those who live here, can now officially enjoy that status."
In his speech, Mr Jack noted Dunfermline's historic links with Scottish royalty. He said: "Dunfermline's rich history is honoured here today, but as important as the area's rich history is, the award reflects the strong local identity and vibrant community of today's Dunfermline."
Dr Iain Greenshields, Moderator of the General Assembly of the Church of Scotland, also spoke at the ceremony. He said: "We are indebted to her late Majesty Queen Elizabeth for conferring, as part of her Jubilee Celebrations, city status on Dunfermline - the Auld Grey Toon.
"A Toon no longer.
"It is a privilege that this ancient capital of Scotland has been honoured in this way and it is a joy for us to gather with His Majesty King Charles to celebrate this significant moment in the history of Dunfermline."
Bill Henderson, 71, who was among the crowds who waited to greet the King and Queen Consort, said locals were excited the town was becoming a city.
He said: "It's a historic event. I was born just before the Queen came to the throne, so she's been my monarch my whole life. It's just exciting.
"And especially King Charles coming back to Dunfermline when King Charles I was born here, however long ago that was."
Teacher Carol Williams, 52, said: "It's such an honour for Dunfermline to be his first visit as the new King." After the ceremony at the city chambers Charles and Camilla visited Dunfermline Abbey, where they saw the resting place of Robert the Bruce.
Catherine Gellan-Adams, 91, said she was "thrilled to bits" that Dunfermline was a city, and met the King as he was leaving the abbey.
She said: "It deserves it."
Don't miss the latest news from around Scotland and beyond - Sign up to our daily newsletter here .
READ NEXT:
Two men to face trial accused of attempted murder in Cumbernauld estate that killed dog
Coastguard and police dogs spend days looking for missing Scots dad as search goes on
Tributes to 'funny and kind' Scots schoolboy who died on holiday in Portugal