Deer hunters claimed victory over the National Trust last night even though they failed in a High Court bid to lift a ban on staghunting in Devon and Somerset.

The ban stayed in place but the National Trust was told by Mr Justice Robert Walker that the "speed and secrecy" with which it had been imposed last April represented a "serious error of judgment" which appeared to pander to media demands.

Leaving the way open for the hunt lobby to challenge the ban within weeks, the judge told the National Trust to go away and reconsider its decision to impose the ban on land on Exmoor and the Quantock Hills.

It was introduced following research by Professor Patrick Bateson, a Cambridge biologist, who proved that deer suffered excruciating pain and fear during a hunt.

Justice Robert Walker, sitting in London, said the National Trust had been preoccupied with reaching a quick decision because of media pressure and public outrage over Professor Bateson's research.

"That seems to have led to secrecy being preferred rather than the opportunity for further consultation and discussion," he said. He described as "questionable" a decision to hold a press conference the day before the ban was imposed and, although deciding not to impose an order, he suggested the council of the National Trust meet again before another hearing to avoid future "expensive" litigation.

Huntsmen were delighted with the judge's comments. Paddy Groves, joint master of the Quantock Staghounds, said they left the way open for a challenge to the ban under the Charities Act in the Chancery Division of the High Court. He expected a hearing within weeks.

"We did not get the injunction making the Trust re-introduce hunting, but everything else clearly went in our favour," he said. "The fact that the judge told them to go away and reconsider their decision is clearly very encouraging indeed. We have what we want - a legal mechanism to challenge the ban - and we believe we will soon have the deer herd of the Quantock Hills in safe hands very soon."

The National Trust's response was more muted. Warren Davis, its spokesman, said the ban still stands but he added: "The National Trust will give serious consideration to the judge's suggestion that its council should discuss the subject again.

"The welfare and conservation of the deer remains the Trust's primary concern and we will continue working with our tenants, neighbours, local deer management groups ... to ensure the herds continue to thrive."

The Trust owns a strategic parcel of land in the Quantock Hills of Somerset and one tenth of the Exmoor National Park in Devon.

The court was told that the Quantocks and Exmoor are popular with visitors but are difficult to farm. Those difficulties were made harsher by the presence of unchecked numbers of red deer which broke down fences and consumed or damaged crops.

The judge said that all the evidence he had heard showed that the deer must be culled to keep the herds healthy genetically and in the interests of the farming community.

Only 10 to 20 per cent of the deer were killed by hunting with hounds each year by packs which had been established from the last century.