With a deteriorating infrastructure and dwindling money in the bank, Bletchley Park, the home of Britain's codebreaking efforts during the War, looked earmarked for closure.

With woodrot in the codebreakers' huts and a leaking roof failing to keep out the elements from the Victorian mansion which was the operation's headquarters, many worried that the site would close within two years.

Earlier this year, The mansion had 16 leaks in just one part of the roof, while one of the huts is still missing an entire wall.

"Money - or lack of it - is our big problem here. I think we have two to three more years of survival, but we need this time to find a solution to this," Simon Greenish, the director of Bletchley Park Trust opined just three months ago.

Bletchley Park - otherwise known as Station X to keep its location secret from the Germans - now houses many exhibits and other memorabilia reminding visitors of the outstanding work of trying to crack the Enigma code. It also houses recently rebuilt replicas of the two main codebreaking machines: the Colossus and the Bombe.

But despite its obvious historical importance, the Bletchley Park Trust had been unable to win significant funding. The Bill and Melinda Gates Foundation turned down its request, while the National Lottery, now the Heritage Lottery Fund, said it was ineligible.

But, following a change in funding criteria by the Heritage Lottery Fund, there is suddenly light on the horizon.

Speaking today, Greenish told SC Magazine that Bletchley Park has entered into detailed discussions for significant funding from the Heritage Lottery Fund.

"We are in serious discussions with the Heritage Lottery Fund. This is prime Lottery territory," said Greenish. "We haven't put in an application yet, but the rules have changed a bit which is helpful."

Greenish said: "We are very positive. This is the solution to all the problems we've got."

In a double twist of luck, Greenish also revealed that the repairs to the roof of the mansion have cost far less than expected.

"The roof has been far cheaper than we dared believe exist," he said. The worst of the damage should now be repaired by the end of the month.

Bletchley Park is taking advantage of the repairs to sell off the slates from the old part of the roof. Each slate is being sold for either £5 or £10 and orders are "flooding in," Greenish said.

Visitor numbers are also increasing. Figures for the first half of this year are 26% higher than 2007 and the numbers could be boosted further by the opening in August of an exhibition dedicated to James Bond creator Ian Fleming.

"There is now a constant drip feed of money," said Greenish.

Separately, nearly 5,000 people have signed an online petition calling on the Prime Minister to save Bletchley Park.

The petition reads: "Please do not allow this crucial piece of both British and World culture to disappear. If ever an example were needed of Britain leading the world, this surely would be it. To allow it to fall into the hands of developers would be simply unconscionable."