WASHINGTON (AP) — The Supreme Court on Thursday allowed construction to resume on a contested natural-gas pipeline that is being built through Virginia and West Virginia.

Work on the Mountain Valley Pipeline had been blocked by the federal appeals court in Richmond, Virginia, even after Congress ordered the project’s approval as part of the bipartisan bill to increase the debt ceiling. President Joe Biden signed the bill into law in June.

The high court’s order came as a three-judge panel of the 4th U.S. Circuit Court of Appeals was hearing arguments in the case.

“All necessary permits have been issued and approved, we passed bipartisan legislation in Congress, the president signed that legislation into law, and now the Supreme Court has spoken: construction on the Mountain Valley Pipeline can finally resume, which is a major win for American energy and American jobs,” West Virginia Republican Sen. Shelley Moore Capito said in a statement.

Lawyers for the company said they needed quick Supreme Court action to keep plans on track to finish building the 300-mile (500-kilometer) pipeline and put it into service by the winter, when the need for natural gas for heating grows.

Environmental groups have opposed the the $6.6 billion project, designed to meet growing energy demands in the South and Mid-Atlantic by transporting gas from the Marcellus and Utica fields in Pennsylvania and Ohio.

Jamie Williams, president of The Wilderness Society, said in a statement that allowing the pipeline to proceed “puts the profits of a few corporations ahead of the health and safety of Appalachian communities. The Mountain Valley Pipeline is a threat to our water, our air, and our climate.”

West Virginia Attorney General Patrick Morrisey, who had asked the Supreme Court to take up the case, said after the ruling that there was an “urgent need” for the pipeline to be completed without delay.

The appeals court did not immediately rule on Mountain Valley Pipeline’s motion to dismiss challenges to the project over concerns about the pipeline’s impact on endangered species, erosion and stream sedimentation.

Derek Teaney, an attorney for Appalachian Mountain Advocates, told the appeals court that Congress’ action last month requiring that all necessary permits be issued for the pipeline’s construction “crosses the fence between the judicial power and the legislative power.”

Appeals Judge James A. Wynn acknowledged, “If we grant the motion, this is probably the last time we’re going to see it.”