By some accounts, the fight against the Dakota Access Pipeline now looks unwinnable. Standing Rock became a ghost town last week after police raided and razed the prayer camp that once hosted thousands of water protectors. Earlier this month, the Trump administration fast-tracked approval to build the final section of the pipeline and cancelled the environmental impact statement ordered by President Obama. Construction is nearing completion and oil could flow through the pipeline as early as March 6. For the Standing Rock Sioux Tribe, time is running out — fast.

The Sioux’s best shot at stopping Dakota Access now lies in court. It may be a long shot, but a legal win is still possible, some advocates say.

A legal challenge filed by the tribe on Feb. 14 charges pipeline builder Dakota Access, LLC, and the U.S. Army Corps of Engineers with a range of environmental, cultural, and treaty-based violations. It asks a federal judge to rule on whether the Army Corps broke laws and treaties by allowing construction of the last leg of the pipeline under Lake Oahe, a reservoir along the Missouri River in North Dakota.

“What you have is this well-supported decision from a past administration to do more and give a full consideration to treaty rights, and then the second administration throws it in the trash,” says Jan Hasselman of Earthjustice, who’s representing the tribe in its lawsuit. “That’s just not how it works.”

Grist thanks its sponsors. Become one.

“It’s absolutely not over,” says Kyle Powys Whyte, a professor of philosophy and community sustainability and a member of the Citizen Potawatomi Nation. He’s been closely tracking the battle against the Dakota Access Pipeline, and he thinks the tribes fighting the project have a good legal case. “Absolutely I think there’s a chance to stop this thing.”

One of the Sioux’s main legal complaints is that construction of the pipeline near its reservation and through sites it considers sacred would violate the tribe’s treaty rights — specifically, its rights under the 1851 and 1868 Fort Laramie treaties. At the heart of the matter is the Sioux’s right to self-determination and tribal sovereignty. Tribes like the Sioux are independent, self-governing nations like any other in the world. And the sovereignty of tribal nations preexists the United States, just like the nations themselves.

Many Native Americans believe that this sovereignty is now under extreme threat. The administration of Donald Trump may be the most hostile to Indian tribes since that of Andrew Jackson, who caused the Trail of Tears in the 1830s, argues Matthew Fletcher, a professor of law at Michigan State University and a member of the Grand Traverse Band of Ottawa and Chippewa Indians.

The tribe’s legal motion also charges that the Army Corps violated the National Environmental Policy Act by terminating an environmental review of the pipeline, and violated the Clean Water Act as well.

Grist thanks its sponsors. Become one.

The Cheyenne River Sioux Tribe has joined the Standing Rock Sioux in its legal challenge, and on Feb. 22, the Cheyenne River Sioux Tribe filed its own motion in the case, calling on the court to reject the Army Corps’ permit for pipeline construction. Several other allies, such as the National Indigenous Women’s Resource Center, have filed amicus briefs supporting the Standing Rock Sioux’s legal case.

Hasselman believes the Sioux have strong legal claims that could lead to the pipeline’s approval being overturned. If the current legal motion fails, he says the tribe will appeal in federal circuit court. Even if oil starts flowing in the pipeline in the interim, it could still be shut off down the line, Hasselman told the Bismarck Tribune.

And tribes are waging other legal battles against the pipeline too. On Feb. 9, the Cheyenne River Sioux filed a motion to temporarily halt construction on the grounds that the pipeline would violate their right to religious freedom by desecrating the sacred waters of Lake Oahe.

“I really hope that the case for religious freedom works,” Powys Whyte says. “This can’t possibly be a country where someone’s business idea can trample someone’s constitutional right to practice their religion.”

The Oglala Sioux Tribe joined the fray on Feb. 13 with its own lawsuit claiming that the pipeline threatened its treaty rights to safe drinking water.

The Cheyenne River Sioux’s religious claim was heard on Feb. 28, and a judge intends to rule on it by March 7. Other motions should be considered in the coming weeks. Still, it could take months, if not years, for all of these cases to move through the courts.

Even if pipeline opponents’ lawsuits are not successful in stopping the pipeline, Powys Whyte sees other gains that have come from the #NoDAPL fight. Standing Rock has provided a template for an indigenous-led movement against projects that pose threats to the environment and to tribes’ sovereignty — a template that could prove crucial to activists over the next four years. He points to two other battles for indigenous rights that will be heating up in coming months: the resistance against the Keystone XL Pipeline and the Tohono O’odham Nation’s staunch opposition to Trump building a border wall on their reservation in Arizona.

Powys Whyte urges non-indigenous environmentalists to get educated about Native American history and tribal rights, and to consult with tribes and incorporate their concerns into campaigns. “Part of the reason why non-indigenous activists are coming late to the Dakota Access fight is because they weren’t aware of the vulnerability and susceptibility Native tribes have,” Powys Whyte says. To learn more, he recommends reading the Native Appropriations blog and the Standing Rock syllabus.

“Literally, if more people supported democratic tribal sovereignty, we wouldn’t have something like the Dakota Access Pipeline happening,” Powys Whyte says.