An investigation is ongoing after a leak in the major Keystone energy pipeline spilled nearly 795,000 litres of oil onto farmland in the US state of South Dakota.

That is the equivalent of 5,000 barrels of oil, said TransCanada, the Calgary-based company that operates Keystone, a 4,324km pipeline which carries crude oil from Canada through the US.

The company said the pipeline was shut down on Thursday morning after the leak was detected near the town of Amherst, South Dakota.

"Emergency response procedures were activated," TransCanada 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."

Brian Walsh, a spokesman for the state's Department of Environment and Natural Resources, told CNN the incident is the largest Keystone pipeline spill to date in South Dakota.

'Groundwater contamination'

Walsh said the leak came from an underground pipeline and that it had been contained at the site, Reuters news agency said.

"It will be a few days until they can excavate and get in borings to see if there is groundwater contamination," Walsh said, according to CNN.

Environmental and Indigenous groups say, however, that the spill should raise serious questions about plans to expand oil pipelines in the US.

Image of Amherst incident taken earlier today by aerial patrol as part of our initial response. For more updates, visit https://t.co/8yWI1Oq2EM pic.twitter.com/uRNtYUdVjL — TransCanada (@TransCanada) November 16, 2017

Cathy Collentine, a senior representative with the Sierra Club's Beyond Dirty Fuels campaign, told Al Jazeera the spill is a reminder "that it's not if a pipeline will spill, but when and where and what the impacts will be".

"It's a stark reminder of what's at risk if we do see tar-sands infrastructure expanded," Collentine said.

The spill also comes a few days before a decision in Nebraska on whether to allow an extension of the Keystone XL pipeline, Keystone's sister pipeline which is also operated by TransCanada, to be built through the state.

The Nebraska Public Service Commission is expected to make its decision on Monday.

"This decision is coming after years of opposition to this pipeline," said Collentine, who explained that landowners, farmers and Indigenous peoples in the state of Nebraska have voiced their concerns.

Thursday's spill "should be evidence enough that Keystone XL should NEVER be built," the Lakota Peoples' Law Project, a group that defends the land rights of Dakota Indigenous peoples in North and South Dakota, wrote on Facebook.

'Very risky'

The Keystone pipeline runs from Alberta through North Dakota, South Dakota and Nebraska, where it splits in two directions: one continues towards Illinois, and the other towards Texas.

While Keystone XL faces stiff opposition in both Canada and the US and was rejected by former US President Barack Obama, Donald Trump has pushed for the contentious pipeline project to go ahead.

Trump gave the green light to construction work last March, opening the door for TransCanada to attempt to secure the necessary state-level permits to begin building the line.

"TransCanada will finally be allowed to complete this long-overdue project with efficiency and with speed," Trump said at the time.

The company says the pipeline will "create thousands of jobs and provide economic benefits to many communities along its route".

In 2015, before he was elected president, Trump also tweeted that the pipeline had "no downside".

So sad that Obama rejected Keystone Pipeline. Thousands of jobs, good for the environment, no downside! — Donald J. Trump (@realDonaldTrump) November 6, 2015

The proposed Keystone XL route, meanwhile, would run from the Alberta tar sands to Nebraska.

In the case of a spill, tar sands oil is especially difficult to clean up because it sinks in water, rather than staying on the surface like other types of oil, Collentine added.

"We don't know how to clean that up," she said. "This is a very risky situation."

Opposition grows

Opposition to major pipelines has grown across North America in recent months. It is often led by members of indigenous communities that lie along the routes of the major energy projects.

Thousands of people, including indigenous tribes across the US and Canada, camped out in North Dakota last year in an attempt to block a multi-billion-dollar pipeline project, the Dakota Access Pipeline.

The Standing Rock Sioux Tribe said the US government failed to properly consult them before it issued permits for the project.

{articleGUID}

In February, however, the US army approved the pipeline's disputed route.

In British Columbia, on Canada's west coast, members of the Secwepemc Nation recently began building tiny homes in the path of a pipeline expansion project that is set to cut through their traditional lands.

Justin Trudeau, Canada's prime minister, approved the Trans Mountain Pipeline expansion project last November.

"We need to take direct action in order to stop this pipeline," Kanahus Manuel, a member of the Secwepemc Women's Warrior Society, told Al Jazeera in September, shortly after construction on the first tiny house began.

The pipeline poses a threat to Secwepemc lands and waterways, Manuel said, and a spill would threaten the community's way of life.

"The land has provided [for] our existence since the beginning and that's what we're fighting for," she said.

Manuel, who also joined the protest movement at Standing Rock, said investors in oil and gas projects should start to rethink those investments.

"They're going to be in for a big fight," she said. "Because of Standing Rock, more and more people are supporting this Indigenous struggle to defend our lands and our waters."