Scott Pruitt, who as Oklahoma’s attorney general spent years suing the Environmental Protection Agency over its efforts to regulate various forms of pollution, was confirmed Friday as the agency’s next administrator.

Pruitt cleared the Senate by a vote of 52-46, winning support from two Democrats, Joe Manchin of West Virginia and Heidi Heitkamp of North Dakota. Only one Republican, Susan Collins of Maine, voted against him, saying he had “fundamentally different” views than she about the EPA’s role.

The vote came after Democrats held the Senate floor for hours overnight and through the morning to criticize Pruitt as a pawn of the fossil-fuel industry and to push for a last-minute delay of his confirmation. Part of their argument was an Oklahoma judge’s ruling late Thursday that Pruitt’s office must turn over thousands of emails related to his communication with oil, gas and coal companies. The judge set a Tuesday deadline for the release of the emails, which a nonprofit group had been seeking for more than two years.

Republicans pressed forward with the afternoon vote, saying Pruitt had been thoroughly vetted in recent months and calling on Democrats to end what Senate Majority Leader Mitch McConnell (R-Ky.) called “a historic level of obstruction” in holding up Trump administration nominees.

Pruitt’s confirmation marked a serious defeat for environmental advocacy groups, which wrote letters, waged a furious social media campaign, lobbied members of Congress, paid for television ads and sponsored a series of public protests to keep the Oklahoman from taking the reins of EPA.

“Scott Pruitt as administrator of the EPA likely means a full-scale assault on the protections that Americans have enjoyed for clean air, clean water and a healthy climate,” Michael Brune, executive director of the Sierra Club, said in an interview. “For environmental groups, it means we’re in for the fight of our lives for the next four years.”

Pruitt has sued the EPA more than a dozen times during the Obama administration, challenging the agency’s authority to regulate toxic mercury pollution, smog, carbon emissions from power plants and the quality of wetlands and other waters. In Oklahoma, he dismantled a specialized environmental protection unit that had existed under his Democratic predecessor and established a “federalism unit” to combat what he called “unwarranted regulation and systematic overreach” by Washington.

And as the one-time leader of the Republican Attorneys General Association and the privately funded Rule of Law Defense Fund, he spearheaded a group of attorneys general that fought the Obama administration on such issues as the Affordable Care Act, Wall Street reforms and efforts to extend overtime pay to more workers.

That combative approach has won him praise from some fellow Republicans and the oil and gas firms that have helped fund his efforts, as well as from Trump, who has criticized the EPA for what he calls burdensome and unnecessary regulations.

“Whoever was nominated by President Trump, the environmental community was going to demonize,” said Jeff Holmstead, who headed EPA’s air and radiation office under President George W. Bush and is now a lawyer representing energy firms. But he said he thinks Pruitt will prove to his critics and to EPA employees that he does believe in the agency’s core mission, even as he has argued that the EPA overstepped its legal authority under Obama.

“Over the past eight years in particular, [the EPA] has completely micromanaged the states. I think you’ll see a real effort to reset that balance,” Holmstead said. “I think he really does believe in the rule of the law. He believes the role of executive branch is to carry out the intent of Congress. I think he’s committed to doing that.”

Still, the prospect of Pruitt leading the EPA horrifies environmental advocates, who accuse him of repeatedly questioning the overwhelming scientific consensus around climate change and often defending the interests of fossil-fuel firms over the health of ordinary citizens.

His nomination also has clearly rattled some agency employees, who fear he will be eager to carry out the promise that Trump made on the campaign trail to “get rid of [EPA] in almost every form. We’re going to have little tidbits left, but we’re going to take a tremendous amount out.”

More than 700 former EPA officials recently wrote to Congress opposing Pruitt’s confirmation, saying he “has gone to disturbing lengths to advance the views and interests of business.”

Even some current employees openly protested his nomination, notably during a recent rally in downtown Chicago near the agency’s Region 5 offices.

Holmstead insisted such protests don’t represent all EPA employees. “I really think that for the vast majority of people at EPA, this idea that there is fear and trembling is a vast exaggeration.”

Minutes after Friday’s confirmation, the EPA tweeted for the first time since Trump’s inauguration.

“We’d like to congratulate Mr. Pruitt on his confirmation!” the tweet read. “We look forward to welcoming him to the EPA.”

We’d like to congratulate Mr. Pruitt on his confirmation! We look forward to welcoming him to EPA.