This story was originally published by Wired and is reproduced here as part of the Climate Desk collaboration.

On his fourth full day in office, President Trump signed an executive order that was supposed to settle this whole Dakota Access Pipeline thing — no more delays due to protests, no more reconsidering the route because of environmental worries. And for a while, it seemed to work. The protest camps are gone, and the pipe has been pumping oil since March. But Thursday, a federal judge ordered a do-over on the rush-job environmental review Trump ordered back in January.

Trump came into office aiming for a blitzkrieg on environmental regulations. He got trench warfare. That’s because firing from the other side of no man’s land is a nimble alliance of environmental groups that have spent decades preparing for the likes of him. You have probably heard of many of them: the Sierra Club, National Resources Defense Council, EarthJustice, and so on. Others are smaller, focused on regional issues — like the Standing Rock Sioux that just won a small victory against the Dakota Access Pipeline. What they all have in common are stubborn, attrition-minded legal teams. Trump’s assault is just a more bombastic version of what these lawyers have weathered under past administrations. And if there’s any green left in the government by 2020, they’ll be the ones responsible.

President Trump is famous for, among other things, his love of infrastructure and hatred of regulations. His Jan. 24 executive order didn’t actually target the Dakota Access Pipeline specifically. It was a sweeping declaration, meant to fast track every new, large, high priority infrastructure project through environmental review. “The White House’s strategy is to deconstruct the administrative state and give favors to the fossil fuel industry,” says Pat Gallagher, director of the Sierra Club’s environmental law program. So these environmental NGOs are changing tack to adapt.

“This is not an abrupt change in our overarching goals,” says Erik Schlenker-Goodrich, the executive director of the Western Environmental Law Center. “This is just a change in footing from offensive to defensive.” Obviously, things were different under the Obama administration. Groups like the Western Environmental Law Center often worked with the government to develop policy.

For example, the Bureau of Land Management’s Methane Waste Prevention Rule. Methane is an incredibly potent greenhouse gas, with more than 86 times the warming potential as carbon dioxide, plus a tendency to leak out of oil and gas drilling equipment. A lot of that drilling happens on public lands, managed by the BLM. So starting in 2008, the Western Environmental Law Center led a coalition of environmental groups in an effort to have the BLM force drillers to plug up their leaks. Their efforts paid off in November 2016 — a week after Donald Trump’s election night victory — when the BLM published a rule that was very close to what the groups had been pushing for.

If you happen to be an environmental news junkie, you already know that the past six months have been quite a ride in methane rule land. First came challenges from drill-happy states like Wyoming and Montana, then more challenges from the drilling industry itself. Congressional Republicans tried to rescind the rule in May, but that effort failed in the Senate. The latest twist came just this week, when the Department of Interior (which is the BLM’s parent agency) announced it was delaying implementation of the rule. Schlenker-Goodrich says the Western Environmental Law Center plans to sue. Back to defense.

So far, some of that defensive action has been relatively easy. “They pulled the plug on a lot of stuff without consideration of requirements they are required to go through to change the rules,” says Michael Wall, the NRDC’s litigation lead. For example, on inauguration day, Trump’s chief of staff ordered all federal government agencies to immediately withdraw any last minute rules made by the Obama administration that hadn’t yet been published in the Federal Register. One of these rules had to do with mercury discharges from dentists’ offices. On Feb. 1, the NRDC filed the first environmental lawsuit of the Trump era, charging that the Environmental Protection Agency didn’t go through the right procedures before rescinding the rule. Long story short, the NRDC caught them on a technical foul.

“This mistake probably reflects an interest by the administration in appearing to get something done without putting in the effort to make sure it was done right,” says Wall. Trump’s EPA eventually relented, and lo and behold the Federal Register finally published the rule this week.

But what the Trump administration’s tactics lack in sophistication they make up in volume. His pan-deregulatory agenda has even environmental lawyers who survived George W. Bush’s eight years of oil industry coziness on their heels. And that’s on top of the usual threats to the environment and public health from various states, local governments, and private industries. So, in addition to litigating, these lawyers maintain intelligence networks to keep track of all the emerging patterns. “We work with grassroots and community groups, or meet with individuals in coffee shops and cafes to learn about local issues,” says Schlenker-Goodrich. He says they also maintain requisite ties in Washington, and use things like Freedom of Information Act requests to keep up on the latest machinations within the federal agencies.

The Standing Rock Sioux’s court victory against the Dakota Access Pipeline is another type of defense. The tribe’s case is essentially fighting to uphold the National Environmental Policy Act, a law passed in 1970 that requires federal agencies to review the environmental impacts of any of their activities. The Dakota Access Pipeline passes under Lake Oahe, which is actually a reservoir created by a dam built by the Army Corps of Engineers on the Missouri River. In early December 2016, after their prolonged standoff, the tribe successfully sued the Army Corps to withdraw the pipeline’s easement under the lake. The Corps said it would begin looking for alternative routes, “through an Environmental Impact Statement with full public input and analysis.”

Then came Trump’s Jan. 24 executive order. Two weeks later, the Army Corps trashed the environmental review and granted the pipeline’s original easement through Lake Oahe.

Despite this week’s court victory, the Dakota Access Pipeline is still pumping oil. For now, the ruling only requires the Army Corps of Engineers reopen its environmental assessment of the pipeline. Depending on how that turns out, the pipe could get shut down for good. And the outcome could have an even longer reach. “Without environmental review, the $1 trillion infrastructure Trump has promised will be a bulldozer for the environment,” says Schlenker-Goodrich. So this is where he, and the other lawyers, will hold the line. Fighting to protect what remains of U.S. environmental protections. Until 2020, or as long as is necessary.