Campaigners are jubilant after a 14-month battle to save the historic Nonsuch Mansion and Nonsuch Park came to an end.
Councillors sitting on Surrey County Council's (SCC) executive committee unanimously agreed that a 125-year lease should be signed, handing over the running of the park and mansion to Sutton and Epsom councils.
The councils intend to offer a long lease to a catering company to restore and renovate the mansion and revive its fortunes.
Surrey's u-turn came after a year of uncertainty following a decision by SCC to intervene in the future of the park.
The mansion was built by Samuel Gamul Farmer between 1802 and 1806. The architectural style is similar to the long destroyed Royal palace built by Henry VIII in the 16th century.
Surrey commissioned a secret report and then floated the possibility of disposing of the mansion for private use, turning it into a hotel or luxury apartments. Opposition to its plans grew day by day.
The details of the report were leaked by a senior council officer horrified at the proposal to sell off Nonsuch.
County Hall was packed on Tuesday with campaigners from Sutton and Epsom, including Sutton and Cheam MP Paul Burstow and Bill Slaughter - chairman of Stoneleigh and Auriol Residents' Association (SARA) - who spearheaded the battle to save Nonsuch.
Before the meeting, Mr Slaughter handed in a petition signed by almost 5,000 people demanding that Nonsuch be preserved for public use.
As well as agreeing a 125-year lease, Surrey agreed to pay £180,000 to make good financial losses absorbed by Sutton and Epsom councils during the period of uncertainty caused by Surrey's intervention in the park's future.
"This was the right decision, but a long time coming. Nonsuch Park is a real local treasure, and local people left Surrey councillors in no doubt how passionate we are about its preservation," said Mr Burstow.
"The 125-year lease is the solution I called for over a year ago. It is just a pity so much time, money and effort has been spent getting here.
"It eventually dawned on the councillors that this was an incredibly unpopular enterprise they had embarked upon and eventually sense prevailed and the Nonsuch should be kept for the benefit of future generations."
"SARA is tremendously grateful to everyone who has supported and assisted the campaign, especially all those who attended SARA's public meeting last October and the near 5,000 people who signed SARA's petition," said Mr Slaughter.
"It is a testament to just how deeply people care about safeguarding the future of Nonsuch Park and the Mansion House.
"They are the real heroes. Neither must we forget to thank another special hero - the high-ranking county council officer who leaked the secret report to SARA, at the personal risk of immediate dismissal."