WASHINGTON — In a surprising win for environmentalists and Democrats and a blow to the fossil-fuel industry, the Senate on Wednesday failed in a bid to reverse an Obama-era regulation restricting harmful methane emissions that escape from oil and gas wells on federal land. The vote was 51-49 in the Republican-led Senate with three Republican lawmakers – Maine’s Susan Collins, Lindsey Graham of South Carolina and John McCain of Arizona – joining forces with the Democrats to block efforts to overturn the rule.

Graham and Collins had publicly opposed the repeal effort, but McCain’s vote surprised many on both sides.

McCain said in a statement he is concerned that the Interior Department rule may be “onerous,” but said passage of a resolution undoing the rule through the Congressional Review Act would have prevented the federal government from issuing a similar rule in the future.

The Obama administration finalized a rule in November that would force energy companies to capture methane that’s burned off at drilling sites because it earns less than oil.