Authorities clear the Oceti Sakowin camp in Cannon Ball, North Dakota, U.S., February 24, 2017. Reuters/Stephen Yang March 7 (Reuters) - A U.S. judge on Tuesday ruled against Native American tribes seeking to stop the Dakota Access Pipeline as their legal options narrow weeks before oil is set to flow on the project.

Judge James Boasberg of the U.S. District Court for the District of Columbia rejected the tribes' request for an injunction to withdraw permission issued by the Army Corps for the last link of the oil pipeline under Lake Oahe in North Dakota.

Energy Transfer Partners LP is building the $3.8 billion pipeline to move crude from the Northern Plains to the Midwest and then on to the Gulf of Mexico.

The denial of the injunction represents yet another setback to the tribes – the Standing Rock Sioux and the Cheyenne River Sioux – that have been leading the charge against the line, which runs adjacent to tribal territory in southern North Dakota.

The tribes had argued that the pipeline would render water they use for religious ceremonies spiritually impure even if the pipeline goes under Lake Oahe. They said the pipeline was reminiscent of an ancient prophesy of a Black Snake that would harm natives and that they could not use other water supplies in the region because they had been polluted by decades of mining.

Boasberg said in a written ruling that the Cheyenne tribe "remained silent as to the Black Snake prophesy and its concerns about oil in the pipeline under Lake Oahe" during two years of legal disputes against the line.

Chase Iron Eyes, lead counsel for the Lakota People's Law Project said "it is simply unacceptable that the government is allowing Energy Transfer Partners to build this pipeline through our sacred lands." The water the pipeline threatens supplies used by the Lakota and more than 17 million other people downstream, he said.

The tribes had won a reprieve from the Democratic Obama administration in early December, but the victory was short-lived as Republican President Donald Trump signed an executive order days after taking office on Jan. 20 that smoothed the path for the last permit needed.

Energy Transfer Partners needed only to cross beneath Lake Oahe, part of the Missouri River system, to connect a final gap in the 1,170-mile (1,885-km) pipeline, which will move oil from the Bakken shale formation to a terminus in Illinois.

The company said in a filing late Monday that it plans to start pumping oil through a section of the line under the Missouri River by the week of March 13.

Lisa Dillinger, a spokeswoman for the pipeline, said the company was pleased with Boasberg's decision and that it has "progressed quickly with the final piece of construction."

Dakota Access Pipeline protesters square off against police between the Standing Rock Reservation and the pipeline route outside the little town of Saint Anthony, North Dakota, U.S., October 5, 2016. Reuters/Terray Sylvester

Fight continues

An oil analyst said the pipeline would help slash transportation costs for producers in the Bakken, one of their biggest expenses.

He predicted that the ruling and the Trump administration's pro-oil stance could clear the way for more pipelines. "If we're setting precedent where we're building pipelines without real restrictions, I think this is a kickoff to what's going to happen in the next few years,” said Carl Larry, president of Oil Outlooks and Opinions.

Public opposition to the pipeline drew thousands of people to the North Dakota plains last year, including high-profile political and celebrity supporters, along with veterans’ groups upset by the use of force by law enforcement.

After the legal victory in December, Standing Rock Sioux chairman Dave Archambault II askedprotesters to leave; the primary protest camp on federal land was evacuated by mid-February, though substantial cleanup remains. The last protesters burned structures as they left the camp.

Archambault said that his tribe and its allies will continue to fight larger legal battles in the case, including the legality of the permitting. The court will next consider issues including the tribes' effort to stop the pipeline from operating until the Army Corps completes an environmental impact assessment that Trump's executive order cut short.

"The fight against the pipeline has changed, but it continues with as much strength as ever," Archambault said. (Reporting by Timothy Gardner and Valerie Volcovici in Washington and David Gaffen, Catherine Ngai in New York; editing by Jonathan Oatis)