When the announcement to close the barracks was made five years ago, local politicians of all parties united to fight the proposals.
"It made no sense economically or strategically to close this modern army base, which not too long ago was hailed as ‘bench-mark accommodation’ by the Ministry of Defence.
"It's not just the loss of jobs at the Barracks, we would have lost the important links between Glencorse and the wider Penicuik community.
"The armed forces personnel and their families play an integral role in life in the town. To lose this would have been devastating both economically and culturally.
"I have petitioned against the decision to close Glencorse Barracks since the decision was announced. I am so glad the UK Government has finally seen sense."
Midlothian South MSP Christine Grahame (SNP) added: “This is fantastic news for all involved – the military personnel and their families, the local community and all those who campaigned to keep the barracks open including my Westminster SNP counterpart Owen Thompson MP.
“They barracks are an absolutely key part of our community and their closure would have been devastating, not least to local businesses.
“This decision should never have been made in the first place – these barracks are well established, equipped and had a £60 million revamp in the mid 2000s. It never made sense to close them and I’m glad the UK Government has finally seen sense on this.”
Built in 1803, the Glencorse camp was used to house French prisoners from the Napoleonic Wars.
Glencorse Barracks has been home to the Army for almost 150 years and currently accommodates 552 service personnel.