Democrats notched wins in a number of key midterm races out West after running on platforms of protecting public lands and maintaining them under federal control ― victories that conservation groups are celebrating as a repudiation of the Trump administration’s “energy dominance” agenda.

The administration’s “deeply unpopular” rollbacks of protected national monuments and its sweeping proposal to open up nearly all U.S. waters to offshore oil and gas development “fueled pro-conservation wins” in states like Nevada, New Mexico and even South Carolina, Matt Lee-Ashley, a senior fellow at the Center for American Progress, said in a statement.

“We are seeing an unmistakable pattern of pro-conservation election outcomes in states and districts that are bearing the brunt of the Trump Administration’s attacks on parks, wildlife, and oceans,” he said.

Public lands were front and center in the contentious Montana Senate race between incumbent Jon Tester (D) and state auditor Matt Rosendale (R). Though President Donald Trump traveled to Montana four times to campaign for Rosendale, Tester ― a frequent critic of the president ― defeated the self-proclaimed “Trump conservative.” And he did it in a state that Trump carried by 20 percentage points in the 2016 election.

ASSOCIATED PRESS Sen. Jon Tester, surrounded by family and supporters, announces his victory Wednesday in Great Falls, Montana.

In campaign advertisements featuring sportsmen and women with shotguns and fly-fishing rods, Tester’s team touted his record of voting to protect public lands, and pegged Rosendale as an East Coast developer who threatened the state’s wild spaces and way of life.

Rosendale, on the other hand, supported transferring federal lands to states during his 2014 bid for the U.S. House of Representatives. That year he told The Billings Gazette that “public lands were never intended to remain in control of the feds.” It’s clear Rosendale recognized that was not a winning stance in Big Sky Country, and promptly reversed course during the campaign to say the exact opposite.

Tracy Stone-Manning, the associate vice president for public lands at the National Wildlife Federation and former chief of staff of Montana Gov. Steve Bullock, said Tester won in part because “voters didn’t buy Rosendale’s late and politically convenient conversion.”

While Tester has an 86 percent lifetime score from the League of Conservation Voters, the nonprofit advocacy group named Rosendale to its 2018 Senate “Dirty Dozen” list of candidates it calls anti-environment. And LCV spent just shy of $1 million on an ad campaign highlighting Rosendale’s support for rolling back federal land protections and his ties to fossil fuel billionaires Dan and Farris Wilks.

In New Mexico, incumbent Sen. Martin Heinrich (D), a fierce critic of Trump’s national monument rollbacks who championed the creation of monuments and wilderness areas in the state, walloped Republican opponent Mick Rich, a commercial contractor who described Heinrich as the “foremost proponent of turning New Mexico into an environmentalists’ Disneyland.” In Nevada, Sen. Dean Heller (R), who called the Obama administration’s 2016 designation of Gold Butte National Monument an “extreme overreach” and urged the Trump administration to modify the boundary, lost his re-election bid to Rep. Jacky Rosen (D). Rosen, who has a 97 percent lifetime score from LCV, campaigned on protecting public lands, including Gold Butte and Basin and Range national monuments, and pushing forward on renewable energy.

Strong support for public lands and environmental protection also appears to have helped boost several candidates in U.S. House races. In Arizona’s 1st Congressional District, incumbent Rep. Tom O’Halleran (D) defeated Wendy Rogers (R), who praised Trump’s decision to open offshore waters and the pristine Arctic National Wildlife Refuge to oil and gas drilling. In Nevada, Steven Horsford (D) defeated Cresent Hardy (R), and Susie Lee (D) beat Danny Tarkanian (R) in the state’s 4th and 3rd Congressional Districts. Both Hardy and Tarkanian support transferring control of federal lands to the state. And in South Carolina’s 1st Congressional District, Democrat Joe Cunningham, an ocean engineer, upset Republican Katie Arrington by standing firmly against Trump’s offshore drilling plans.

Conservation groups, including CAP and Colorado-based Center for Western Priorities, also celebrated wins in a number of state races. Those included the victory by Colorado’s Jared Polis, the first openly gay man elected governor in the U.S., who during the campaign connected his opponent, Walker Stapleton (R), to Interior Secretary Ryan Zinke and the administration’s efforts to roll back public lands protections.

“Voters across the West voted with their values and their wallets when they elected representatives that support public lands, access to them and the wise management of them,” Stone-Manning said.