KING Charles offered his "warmest congratulations" as he conferred city status on Dunfermline.
The former town was one of eight communities awarded the honour as part of the late Queen's Platinum Jubilee celebrations.
In a ceremony in the city chambers, the King said he was “delighted” when it was announced the town would become a city.
He said he hoped people would feel a “real sense of pride in this new chapter”.
First Minister Nicola Sturgeon was also in Dunfermline for the monarch's visit.
Dunfermline SNP MP Douglas Chapman said: "This official recognition has been a long time coming but once we have enjoyed the day when City status has been bestowed on us, that's when the hard work needs to begin.
"This cannot be a mere change in signage, but it is a great opportunity for Dunfermline to grow a sustainable, smart city economy that gives hope, purpose and prosperity to current and future citizens."
The King highlighted the city's "immense significance" in Scottish history as the birthplace of entrepeneur and philanthropist Andrew Carnegie.
He added: "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."
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 city's abbey, which Charles and Camilla visited during their time in the city.
Chapman added: "As Scotland's eighth city, we are ideally placed to make the most of this exciting opportunity and at the heart of this process should be the people who live here. It's their city ... let's make it work for all of us."