Charles said he was “thrilled” to see the fully restored New Cumnock Town Hall in East Ayrshire back in use, as he met members of the 30 community groups it will serve.
He toured the town hall’s computer room before meeting staff and children from the local nursery and members of community arts and sports groups.
Charles, who is known as the Duke of Rothesay when in Scotland, was also treated to a special ballet performance by the PA School of Dance before unveiling a plaque to mark the occasion.
The town hall was originally built in 1888 and was earmarked for demolition before the Dumfries House Trust took on its restoration.
In his capacity as Great Steward of the Dumfries House Trust, Charles headed a consortium of charities and heritage bodies which bought the house and its land in 2007.
Addressing those gathered to mark the opening of the town hall, Charles said he hopes the building will be “a real asset” for the local community.
He said: “I really could not be more thrilled to be joining you here today in the newly refurbished New Cumnock Town Hall.
“When I first took on Dumfries House it was always my greatest ambition to do as much as possible for all the various communities surrounding the estate, so this project is our first foray into this work and I very much want to thank the people of New Cumnock for being so wonderfully welcoming and enthusiastic.”
He added: “It will be 10 years next year since we started at Dumfries House. A huge amount has changed since then, change that I hope has benefited many people in our local community.
“Dumfries House, I need hardly say, has a very special place in my heart for all sorts of reasons and I look forward to working for many more years within this wider community and beyond in continued effort to do what I can to help in this part of Scotland.”
The project was part funded by businessmen Sir Tom Hunter, who grew up in New Cumnock.
He hailed the restoration as a “wonderful day” for the town and said Charles’s leadership on the project “would not be forgotten”.
The project is part of a wider regeneration of New Cumnock town centre, which will include the transformation of the swimming pool.
Gordon Neil, development and facilities manager at the Dumfries House Trust, said it aims to “bring the heart back to the community”.
He said: “We were approached a number of years ago to see if we would assist to try and save this building as it was earmarked for demolition.
“We took it on board and the Prince got involved, he was very passionate about it as he always has a passion for historic buildings and didn’t want to see it going to waste.
“The purpose of the building was to give the community something back. It’s made a massive difference. The reaction has been so positive. Everyone has been really behind it 110%.”