The U.S. State Department must conduct a new environmental review for the Keystone XL crude pipeline, a federal judge ruled, dealing a blow to a project supported by President Donald Trump in his first few days in office.

U.S. District Court Judge Brian Morris in Montana sided with indigenous and environmental groups in ruling Wednesday that a revised Keystone route is “interdependent” on the larger pipeline project and requires one environmental review.

Grady Semmens, a spokesman for Keystone developer TransCanada Corp., didn’t respond to a phone call seeking comment.

While the court declined to vacate the State Department’s so-called “presidential permit,” it called the government’s argument that the permit applies only to the segment of the pipeline that crosses the U.S.-Canada border “unpersuasive.”

Under the revised route, the Keystone XL pipeline would cross different counties and water bodies, run longer and require an additional pump station and power line infrastructure, the court said. Because of those differences, federal defendants “cannot escape their responsibility” to evaluate the alternative route.

The court’s ruling comes after the cross-border oil pipeline won a relatively positive preliminary review from the State Department, which found that the conduit’s approved route would have no significant environmental impacts. That came in a draft environmental assessment -- a shorter review than the environmental impact statement ordered by the U.S. District Court in Montana.

Aside from Morris’s ruling, Keystone is also facing a case before the Nebraska Supreme Court, which the company expects to be resolved later this year or in early 2019. TransCanada has said it will not begin construction until the second quarter of 2019.

The case is Indigenous Environmental Network et al. v. U.S. Department of State, 4:17-CV-00031-BMM, U.S. District Court for the District of Montana (Great Falls).

Updates to include details from court order beginning in fourth paragraph.

--With assistance from Ryan Collins.