WASHINGTON — Dealing another legal blow to the Trump administration, a federal appeals court ruled on Monday that the Environmental Protection Agency cannot suspend an Obama-era rule to restrict methane emissions from new oil and gas wells.

The 2-to-1 decision from the United States Court of Appeals for the District of Columbia Circuit is the first major legal setback for Scott Pruitt, the E.P.A. administrator, who is trying to roll back dozens of Obama-era environmental regulations. The ruling signals that President Trump’s plans to erase his predecessor’s environmental record are likely to face an uphill battle in the courts.

The administration has already suffered several reverses in federal court to its plans to limit immigration from a group of majority-Muslim nations. A federal judge in California also blocked the administration’s threat to penalize cities that provide legal sanctuary for illegal immigrants.

A number of other E.P.A. actions to undo regulations it inherited, including a rule on landfills and another on chemical spills, are likely to receive close scrutiny from the courts because of this ruling.

In upholding green groups’ efforts to end the E.P.A.’s 90-day stay over parts of the regulation, the appeals court ruled that the agency’s decision was “unreasonable,” “arbitrary” and “capricious.” The agency, it said, did not have authority under the Clean Air Act to block the rule.

“E.P.A.’s stay, in other words, is essentially an order delaying the rule’s effective date, and this court has held that such orders are tantamount to amending or revoking a rule,” Judges David Tatel and Robert Wilkins wrote. The third member of the three-judge panel, Janice Rogers Brown, dissented. The judges said the agency would have to undertake a new rule-making process to undo the regulation.

The methane rule was part of a broad suite of climate regulations enacted by former President Barack Obama. Methane is a potent greenhouse gas 25 times more powerful than carbon dioxide.

Oil and gas companies have argued that the rule requiring them to report and fix any methane leaks in their equipment is an unnecessary burden because many oil-producing states already have their own regulations. The E.P.A. announced on June 5 that it was suspending enforcement of the rule, arguing that the industry had not had enough opportunity to comment. The court rejected that argument.

“The court’s decision ends the continued pollution by the oil and gas industry that’s been illegally allowed by Pruitt,” said Fred Krupp, president of the Environmental Defense Fund, one of the plaintiffs in the case.

Reid Porter, a spokesman for the American Petroleum Institute, said that standards set in 2012 are already reducing methane emissions. “A stay is needed to allow for regulatory certainty as E.P.A. continues the formal process to review the rule making,” he said in a statement.

An E.P.A. spokeswoman said the agency was reviewing the opinion and would weigh its options.

Monday’s decision does not mean the methane rule cannot be reversed. But to do so, the E.P.A. will have to write a new rule to unwind it and must comply with the Obama-era regulation in the meantime.