A U.S. federal judge has cleared the way for the completion of a $244-million water project that could possibly bring harmful bacteria to Manitoba's Hudson Bay Basin.

U.S. District Judge Rosemary Collyer in Washington, D.C., ruled Thursday that the Northwest Area Water Supply project complies with federal environmental law. The project will bring Missouri River water to residents of northwestern North Dakota. From there, water from North Dakota flows into Manitoba waterways.

NAWS was first authorized by Congress in 1986, but it's been tied up in the courts the last 15 years. Manitoba sued in 2002, when construction began, over concerns about the pipeline's possible transfer of harmful bacteria or other agents from the Missouri River Basin to the Hudson Bay Basin north of the border.

Missouri sued in 2009 over fears that the pipeline would deplete one of its key sources of water. The Missouri River provides water to 3 million Missouri residents and is vital to the state's shipping and agriculture industries.

The U.S.federal Bureau of Reclamation in 2015 released its final environmental study on the project, calling for more stringent water treatment. Collyer said the study satisfies federal law requirements, and she ruled in favour of the U.S. government while rejecting Manitoba's claim and dismissing Missouri's.

"This court's work is done because the Bureau of Reclamation has finally done its work," Collyer wrote.

Both plaintiffs can appeal. Attorneys for Manitoba and Missouri didn't immediately respond to requests for comment Friday.

North Dakota Attorney General Wayne Stenehjem applauded the ruling, calling it "a significant victory for the citizens of North Dakota."

"Although the opinion is subject to appeal, this is a giant step forward in resolving the legal issues that have delayed the completion of the NAWS project for over a decade," he said in a statement.

North Dakota State Engineer Garland Erbele called the ruling "a major milestone" for the project designed to deliver drinking water to state residents.

"The completion of this project will address the well documented water supply needs within the north central region of our state," Erbele said in a statement Friday.

U.S. Sen. Heidi Heitkamp, a North Dakota Democrat who has been pressing for completion of environmental reviews of the project, also hailed the ruling.

"Every rural community needs a solid foundation of clean drinking water at their fingertips, and I look forward to continuing to work with the Bureau of Reclamation to make that a reality," Heitkamp said.

Republican U.S. Rep. Kevin Cramer of North Dakota said the project "is critical for safe and reliable water to the City of Minot and the surrounding area." He said it also will promote economic and population growth in the region.

Collyer has allowed much of the project's infrastructure to be built while the battle over water testing played out. She has now lifted all remaining injunctions on construction.