The Senate failed to advance a measure to repeal a rule loathed by oil and natural gas companies, as Senate Majority Leader Mitch McConnell suffered a rare legislative defeat by just one vote.

The 49-51 procedural vote means a resolution to nullify the regulation from the Bureau of Land Management falls short after passing the House. Democrats united against the measure, and were joined by Republican Sens. Lindsey Graham, Susan Collins and John McCain. Graham and Collins had long said they opposed the repeal, but McCain was a surprise no vote.

“We actually thought we had just enough,” Sen. John Hoeven, a North Dakota Republican who supported the repeal, said. “But as it turns out we lost three and didn’t get any help from the Democrats.”

The vote followed a tense Senate session as the Capitol was reeling from President Donald Trump’s surprise firing of FBI Director James Comey the night before. All Democratic members were urged to attend the opening statements, during which McConnell rejected calls for a special investigative committee to probe Russian involvement in the presidential election. McCain was one of the Republicans who had called for the special committee.

Dick Durbin, the No. 2 Senate Democrat, also objected to a routine request to allow committees to continue meeting longer than two hours, citing the firing of Comey.

Before the vote, two Democratic senators, Joe Manchin of West Virginia and Heidi Heitkamp of North Dakota, were mentioned by lobbyists as possible supporters of the methane measure, but both opposed it in the end. Vice President Mike Pence was at the Capitol in case his vote was needed as a tiebreaker in a sign that McConnell thought the vote would be close.

Hoeven said McCain initially said he would vote with Republicans but then late last night told proponents he “had some concerns.” The Senate has one more day to pass the measure, so it could return if proponents are able to convince McCain or a Democrat to switch their vote.

“Improving the control of methane emissions is an important public health and air quality issue,” McCain said in a statement after the vote. “While I am concerned that the BLM rule may be onerous, passage of the resolution would have prevented the federal government, under any administration, from issuing a rule that is ‘similar.’”

Mark Brownstein, vice president of the climate and energy program at the Environmental Defense Fund, said “once again, John McCain demonstrates that he is a voice of common sense and reason in the Senate.”

The rule, finalized by the Obama administration in November, requires oil and gas companies to plug accidental leaks of natural gas and scale back the practice of intentionally venting or burning the gas as they extract more profitable crude oil.

The Interior Department is already reviewing the venting and flaring regulation, which aimed to discourage unabated burning and releases of methane, the primary component of natural gas. Interior Secretary Ryan Zinke has been critical of the “waste” associated with venting and flaring. “It’s the taxpayers’ oil and gas resource,” Zinke said in an interview. “To waste it, for future generations, I’ve never been very comfortable with that.”

The vote took place under the expedited procedures of the Congressional Review Act. Until President Donald Trump was elected, the act, created in 1996, had only been used once in 2001 to overturn a regulation a Labor Department ergonomics rule issued by the Clinton administration.

Trump has signed into law more than a dozen CRA measures to block regulations issued by his predecessor, including rules related to bear hunting by airplane in Alaska, gun purchases by the mentally ill and protections for streams from the effects of coal mining.

And now time is running out to use the measure. Congress only has 60 legislative days of a rules’ enactment to pass a CRA under a simple majority vote, and that is estimated to expire Thursday.

Bloomberg’s Jennifer A. Dlouhy contributed.