RICHMOND, Va. (AP) — A U.S. appeals court on Friday tossed out a key permit for the Atlantic Coast Pipeline that deals with the project’s effects on threatened or endangered species, saying a federal agency had apparently “lost sight of its mandate.”

A three-judge panel of the 4th U.S. Circuit Court of Appeals wrote that the U.S. Fish and Wildlife Service had made decisions that were “arbitrary and capricious” in its authorization for the pipeline.

“In fast-tracking its decisions, the agency appears to have lost sight of its mandate under the (Endangered Species Act): ‘to protect and conserve endangered and threatened species and their habitats,’” the court wrote.

The decision is the latest in a series of legal setbacks for the 600-mile (965-kilometer) pipeline, the construction of which has been on hold since December. The project designed to carry natural gas from West Virginia into Virginia and North Carolina is years behind schedule, and its total cost has increased by about $2 billion.

The appeal dealt with four species: the rusty patched bumble bee; the clubshell, a mussel; the Indiana bat; and the Madison Cave isopod, a crustacean.

Last year, the court vacated the Fish and Wildlife Service’s incidental take statement, which usually authorizes a project to harm or kill no more than a limited number of threatened or endangered species.

Soon after, the agency revised its work and issued a new one, which environmental groups challenged.

The court wrote that it could not ignore that it took the agency “a mere 19 days” to issue the new incidental take statement and related biological opinion after the court’s first decision.

“In its rush to help this pipeline company, the agency failed to protect species on the brink of extinction – its most important duty. This pipeline would blast through some of the last populations of these rare animals,” said Patrick Hunter, an attorney with the Southern Environmental Law Center, which represented the environmental groups that sued.

A spokeswoman for the Fish and Wildlife Service said the agency is reviewing the decision.

A spokesman for lead developer Dominion Energy said the company expects the Fish and Wildlife Service and federal regulators who oversee interstate natural gas pipelines will be able to immediately begin working to resolve the issues.

“Once the new Biological Opinion and Incidental Take Statement are issued, we will seek the necessary approval from the Federal Energy Regulatory Commission to resume construction. We’re confident we remain on track to complete the project by late 2021,” spokesman Aaron Ruby wrote in an email.

Dominion, which is a partner in the pipeline along with Duke Energy and Southern Co., says the project will lower energy costs and boost economic development, both through its construction and by increasing the availability of natural gas.

Opponents say the project will cause environmental harm and question the need for a massive natural gas pipeline at a time when they say climate change makes it imperative to invest in renewable energy.