Developers whose hopes of building up to 180 new homes in a Wiltshire village were raised, but then dashed, due to an administrative blunder have failed in a test case compensation bid.

Gleeson Developments Limited were popping the champagne corks when, on March 18 this year, they were told that a government inspector had decided to grant them outline planning permission for the huge development in Malmesbury.

But the very next morning, their triumph turned to gloom when the they were informed that the, due to a crossing of official communications, the decision had been issued 'in error'.

It turned out that, less than three hours before Gleeson were given the good news, Planning Minister, Nick Boles, had decided to 'call in' the company's application for personal determination by Communities Secretary, Eric Pickles.

The inspector's decision was swiftly 'withdrawn, but the furious developers took their case to the High Court, saying their human rights had been violated.

They also insisted that the inspector's decision became valid and enforceable the moment it was officially issued and the only way of undoing the error was to formally revoke the planning consent and pay Gleeson substantial compensation.

Mr Boles' 11th-hour move - which came after it had earlier been announced that Mr Pickles was happy to leave the final decision to the inspector - was also 'irrational', Gleeson's lawyers argued.

However, dismissing the developers' complaints, Mr Justice Cranston said it could not have been Parliament's intention to make it impossible for the planning inspectorate to put right such a 'simple and obvious' administrative mistake.

Mr Boles had decided to intervene before Gleeson was mistakenly given the good news and, 'as a matter of basic principle', the inspector's decision was issued without authority and had no legal effect, he said.

The judge, sitting at London's High Court, also rejected Gleeson's plea that the failure to consult it before Mr Boles reached his decision was fundamentally unfair.

The Minister, he said, had decided to intervene in the light of the substantial size of the development and the March 2013 publication of a draft neighbourhood plan for the area.

Noting that the planning inspectorate had acted immediately once the mistake was spotted, the judge said 'good administration' demanded that a 'modest power' to withdraw decisions issued in error had to be implied into the legislation.

Gleeson's arguments that it had had a 'legitimate expectation' that planning permission had been granted and that the decision's withdrawal amounted to a breach of its human rights were also dismissed.

However, Mr Justice Cranston noted that the company remained fully entitled to a 'fair determination' of its planning application by Mr Pickles.