The owners of the controversial Keystone pipeline shut the system down on Thursday after discovering it had leaked 5,000 barrels of oil in remote South Dakota.

TransCanada said its crews shut the pipeline down at 5 a.m. Mountain Time after discovering a drop in pressure in the operating system resulting from a leak.

The closure effects the pipeline from Hardisty, Alberta, to Cushing, Oklahoma, as well as Wood River and Patoka in Illinois. The southern leg of the system to the Gulf Coast remains operational, the company said.

“We have been keeping our shippers and customers up to date and have communicated that the pipeline ... is expected to remain shut down as we respond to this incident,” the company said in a statement. “The safety of the public and environment are our top priorities and we will continue to provide updates as they become available.”

The leak remains under investigation and occurred just days before the Nebraska Public Service Commissioner was set to announce its decision on an 830,000-barrel expansion through the state.

“These pipelines are bound to spill, and they put communities, precious drinking water and our climate at risk,” Greenpeace said in a statement following the spill. “An approval of yet another pipeline is a mistake.”

President Donald Trump approved an extension of the pipeline in March, reversing the Obama administration's decision to block the controversial oil project.