The Senate on Wednesday rejected a bid to overturn an Obama-era rule that limits climate-warming methane leaks from oil and gas operations on public lands, but the industry, along with its allies in Congress, says it will continue challenging the rule.

The surprise 49-51 vote handed a defeat to the industry, which has pushed Congress to undo the rule under the Congressional Review Act, a little-used law that allows lawmakers to kill rules with a simple majority vote.

The rule, issued by the Department of the Interior at the end of the Obama administration, limits venting and flaring of methane from natural gas and oil drilling operations, a restriction that officials estimated would prevent 180,000 tons of methane from leaking into the atmosphere every year. Methane, the main component of natural gas, is a short-lived climate pollutant with over 80 times the warming power of carbon dioxide over a 20-year period.

Cutting methane emissions was a key element of Obama's plan for meeting the U.S. commitment under the Paris climate agreement, and many experts view methane cuts as an especially efficient way to reduce emissions in the short term. Proponents of the rule also point out that the methane that escapes during the flaring and venting process could power more than 6 million homes.

"The rule is so basic. All it's asking for is for oil and gas companies to capture their methane waste, which is now going up into the atmosphere as carbon pollution, and really potent carbon pollution at that, and put it back into their pipes and, potentially, back into the market," said Lena Moffitt, who directs the Sierra Club's Beyond Dirty Fuel campaign. "It's just asking them to plug their leaks."

The oil and gas industries, emboldened by the Donald Trump administration and backed by conservative groups, said the rule duplicated existing state rules and would lead to higher energy costs, job losses and less energy production on public lands. On Tuesday, the American Petroleum Institute made a final appeal to lawmakers to vote for the resolution, sending a letter that called the rule "flawed."

The House of Representatives passed a resolution to overturn the rule in February.

Going into the vote Wednesday morning, Republican proponents believed they had the required 51 votes to overturn the rule. But a trio of Republican senators—Lindsey Graham of South Carolina, Susan Collins of Maine and John McCain of Arizona—voted against the measure.

"This vote demonstrates that the oil and gas industries, and its allies in the Trump administration, simply misread the mood of the public," said Mark Brownstein, a vice president at the Environmental Defense Fund. "The difference was John McCain. ... He didn't say how he was going to vote, so people assumed he was going to go along with the herd."

Environmental groups said it was possible that the resolution to kill the methane rule could come up for a vote again, but it was unlikely, given McCain's opposition. Under the Congressional Review Act, Congress has to act on any resolution to repeal a rule within 60 Congressional working days. The final deadline would be Friday, by most estimates.

In a statement issued Wednesday, McCain said: "While I am concerned that the BLM [Bureau of Land Management] rule may be onerous, passage of the resolution would have prevented the federal government, under any administration, from issuing a rule that is 'similar,' according to the plain reading of the Congressional Review Act. I believe that the public interest is best served if the Interior Department issues a new rule to revise and improve the BLM methane rule."

The industry said it plans to pursue lawsuits challenging the Interior Department's authority to regulate air quality.

"We'll also be working closely with the Department of the Interior on reviewing and rescinding this rule," said Kathleen Sgamma, president of the Western Energy Alliance. "BLM has the authority to regulate waste, but that's not what it did in this rule. It imposed air quality controls that read almost verbatim from EPA rules."

Any potential rulemaking, though, would have to undergo a rigorous public process.

"It's really encouraging to see that when communities and constituents band together, they can defeat even the most well-funded foes," Moffitt said, referring to the lobbying push by the oil and gas industry. "They've been emboldened. They have a friend in the White House. But even with all that, this victory shows they can't get their way all the time."