Thousands of military homes will be brought back into public ownership at a cost of almost £6 billion.
The Ministry of Defence will buy back 36,347 homes from property firm Annington, reversing the 1996 privatisation process.
Ministers and officials said the deal would mean ending the £230 million annual rental cost of the homes.
Defence Secretary John Healey said the “dreadful deal” to privatise the service family estate was a “fire sale” by the Conservatives in the run-up to the 1997 general election.
“Today ends one of the worst-ever government deals,” he said.
Mr Healey said problems with military accommodation “will not be fixed overnight” but “this is a decisive break with the failed approach of the past and a major step forward on that journey”.
He said: “This is a once in a generation opportunity, not only to fix the dire state of military housing but to help drive forward our economic growth mission, creating jobs and boosting British housebuilding.
“Our armed forces and their families make extraordinary sacrifices: theirs is the ultimate public service.
“It is shameful that in the lead up to Christmas, too many military families will be living with damp, mould and sub-standard homes – issues which have built up over the past decade.
“We are determined to turn this around and renew the nation’s contract with those who serve.
“These important savings to the defence budget will help fix the deep-set problems we inherited.”
The service family estate sold in 1996, which is now valued at £10.1 billion when not subject to leases, is being purchased for £5,994,500,000.
The process of taking the homes back into public ownership began under the Conservatives, with the MoD winning a legal battle in 2023 to take some of the properties back.
The arrangement with Addington meant homes were rented at a discount from market rate but the taxpayer was responsible for maintenance costs – and improvements could potentially push up rents.
Despite most of the properties dating from the 1950s and 1960s, the Annington deal has prevented the MoD from being able to demolish them to build newer accommodation.
The MoD said the previous deal left the taxpayer nearly £8 billion worse off, with £4.3 billion in rental payments and vacant properties worth around £5.2 billion handed back to Annington, partially offset by the £1.7 billion income generated in 1996 as part of the original deal.
Because the deal eliminates the liabilities associated with the leases, the impact on net financial debt will be limited to £1.7 billion despite the near £6 billion outlay.
Treasury Chief Secretary Darren Jones said: “This is a landmark deal that will start saving the taxpayer money immediately, all while driving forward our mission to create growth across the country.
“Not only does it open the door to major development and improvements across the military housing estate, but most important of all, it will help us on our mission to build more houses and deliver our service personnel the homes they deserve.”