The transport secretary, Chris Grayling, has been granted an injunction banning campaigners opposed to the construction of the HS2 line on an area of ancient woodland in west London from “unlawful protest” on the site.

The government, along with HS2, sought the injunction to stop eight protesters’ demonstrating on the site in Colne Valley, Hillingdon. However, they admit the project is controversial and acknowledge that many groups and individuals have concerns about various aspects of HS2, including cost and environmental impact.

Regular protests against the impact of the rail line on trees and wildlife have been staged since last October. Grayling and HS2 accuse the protesters of trespass and obstruction of access to the site, and say they have attached themselves to trees and machinery in a bid to disrupt work.

The high court was told on Monday there had been 31 different incidents involving protesters since last October.

The protesters say they are trying to save up to 100 acres of ancient woodlands – an area of natural beauty that can never be replaced – and 2,400 different species of flora and fauna. HS2 says it is creating an ecology habitat (pdf) on the site.

The judge, Mr Justice Barling, praised the protesters as “committed environmentalists”. “Their motives are entirely laudable,” he said. Nonetheless, he granted the injunction.

Paul Powlesland, a barrister who represented one of the protesters, Sarah Green, said the case could be the first of many: “It’s part of a growing trend for companies to use injunctions and private law remedies against political protesters.”

Critics of the high-speed rail scheme have expressed concern about excessive costs and damage to the environment. Supporters of the plan say that, when completed, it will be the fastest rail network in Europe with trains able to carry 1,100 passengers travelling at 250mph.

Costs are escalating and the project has been billed as the world’s most expensive railway development. The first phase is costing £24bn, which is forecast to rise to £56bn for the whole scheme.

Jonathan Bartley, the Green party co-leader, said:“Today we saw an attack on the democratic right to peaceful protest right from the top of government. But the campaign against HS2 will not be silenced.

“We will continue to stand in solidarity with campaigners putting their bodies on the line in the fight to stop this vanity project. HS2 will trample communities, businesses and nearly a hundred ancient woodlands. It is environmental vandalism and it must be stopped.”

A HS2 spokesperson said the injunction would help to deliver the project safely, on time and on budget. They said: “Alongside the economic benefits, HS2 will deliver a new ‘green corridor’ made up of woodland, wildlife habitats and amenity facilities, designed to blend the line into the landscape and leave a lasting legacy of high-quality green spaces all along the route.

“We understand that people feel strongly about the impact the project will have on their community, and that they want us to hear their views. That is why we offer numerous channels through which they can make their feelings understood.”