Pat Hayden, vice-chair of the trust, expressed deep disappointment but said: "How we feel is much less important than the impact on the species we exist to protect. We owe it to our members to do our utmost to protect badgers." The trust is now considering an appeal.

"We are pleased with the judgment," said a spokesman for the Department for Environment, Food and Rural Affairs (Defra). "No one wants to cull badgers but in 2011 bovine TB led to the slaughter of over 26,000 cattle and to help eradicate the disease it needs to be tackled in badgers. We will continue to work with the farming industry so badger control in two pilot areas can start as soon as is practical."

The judicial review considered only legal arguments, not scientific ones. In the course of the hearing, the government accepted that a landmark decade-long trial had shown that fleeing badgers carried TB to new areas. That trial found that, at best, TB incidence was reduced in the cull area by just 16% after nine years. The government also accepted the culls could cost farmers more than doing nothing.

David Williams, the chairman of the trust, said: "The Badger Trust emphatically did not ask the court to adjudicate on the science around culling. That remains exactly the same as it has been for a decade. Despite a constant stream of evidence that culling will make matters worse and growing consternation from many farmers, the coalition government intends to press ahead with its expensive and pointless policy."

Martin Haworth, NFU director of policy, said: "Given the public interest in this issue, we always knew that there would be a legal challenge. We are pleased the judge has ruled that Defra's approach is lawful. This policy is desperately needed to tackle what is a terrible and damaging disease that affects cattle and badgers and brings misery to the lives of many hard working farming families."

In court, the Badger Trust's legal team had argued that the cull would break the 1992 law protecting badgers, which only allows culling to "prevent the spread of disease". The trust's lawyers also argued that the cost-impact assessment of the environment secretary, Caroline Spelman, was flawed as it was based on shooting free-running badgers, rather than the far more expensive method used in the decade-long trial of trapping the animals in cages first. But Kate Grange, of the government legal team, told the court: "[Mr Justice Ouseley] has rejected the application in clear and robust terms."

The trust now has seven days to seek leave for an appeal, a shorter period than the usual 21 days. Grange said: "Given where we are with the pilots, that is not unreasonable."

The Badger Trust said in a statement: "The judgment demonstrates that the legislation in this area has not kept pace with developments in the understanding of how TB works."

The RSPCA's David Bowles said: "We are bitterly disappointed. We believe culling is not a long-term, sustainable solution. It is not as if there aren't alternatives to a cull. Vaccination could be more effective and sustainable."

A badger vaccination programme is replacing a planned cull in Wales, following legal challenges and the election of a new political administration. Vaccination is being tested by the National Trust in Devon and by the Wildlife Trust in Gloucestershire. The previous Labour government said an oral badger vaccine would be ready by 2015. The coalition cancelled five of the six trials of injectable vaccines and Spelman says a useable oral vaccine is "years away".

The government is also facing a complaint at the Council of Europe from the Humane Society International (HSI), which argues the badger cull contravenes the Bern Convention that protects wildlife. Mark Jones, veterinarian and executive director of HSI said: "This may now be the badgers' last hope and we are determined to do everything we can to prevent this bloody and pointless slaughter."

The Badger Trust, RSPCA, the League against Cruel Sports and other groups will hold public meetings in the next week to discuss the cull at Taunton and Tewkesbury, both towns in the two pilot areas.

• The original version of this story wrongly stated a pilot cull was planned for Devon, not Somerset.