More than 9,000 barrels of oil are estimated to have spilled from a leak in the Keystone Pipeline in northeastern North Dakota, the company said. It's the second significant spill in two years in the pipeline that runs from Canada's tar sands region and through seven U.S. states.

Crews shut down the pipeline after the leak was discovered Tuesday night, Karl Rockeman, North Dakota's water quality division director, told the Associated Press. The oil spill affected a wetlands area.

TC Energy, formerly known as TransCanada and which operates the pipeline, said Thursday that an estimated 9,120 barrels of oil, enough to fill half of an Olympic-sized swimming pool, was released in the spill.

Land affected by a Keystone oil pipeline leak near Edinburg, North Dakota. Taylor DeVries / North Dakota Department of Environmental Quality via AP

Using that initial estimate, that amounts to around 383,000 gallons. The company says it won’t know the exact amount until oil recovery has been finished.

The leak occurred near the company's facilities near Edinburg, a community of around 200 people in Walsh County around 60 miles northwest of Grand Forks, TC Energy said. The North Dakota Department of Environmental Quality said the leak was 3 miles northwest of Edinburg.

"Our emergency response team contained the impacted area, and oil has not migrated beyond the immediately affected area,” TC Energy said in an earlier update.

It said that crews remain focused on oil recovery and will then make repairs to the pipeline. Crews are using vacuum trucks and backhoes to recover the oil, it said.

Rockeman told the AP that some wetlands were affected, but not any sources of drinking water.

In November 2017, more than 200,000 gallons of oil — around 4,700 barrels — leaked in South Dakota. The leak occurred in a sparsely populated area of Marshall County, near Amherst in the northeastern part of the state.

The $5.2 billion pipeline is designed to carry crude oil across Saskatchewan and Manitoba, and through North Dakota, South Dakota, Nebraska, Kansas and Missouri on the way to refineries in Patoka, Illinois, and Cushing, Oklahoma, and it can handle 23 million gallons daily.

TC Energy is also seeking to build the Keystone XL pipeline that would begin in Hardisty, Alberta, and go to Steele City, Nebraska.

Because the pipeline would cross an international border, the U.S. State Department is collecting public comments on its revised environmental impact statement for the pipeline, NPR reported Thursday. An Oct. 4 entry in the Federal Register says the public comment period is expected to end on Nov. 18.

The Keystone XL proposal was rejected by the Obama administration in 2015, but approved by the Trump administration in 2017.

TC Energy says the XL pipeline will create jobs during construction as well as other benefits.

It says on its website it wants to start construction in 2020, and that construction will take around two years.

Environmental groups and others have opposed the project. The Sierra Club said in a statement Wednesday that the spill from the Keystone 1 pipeline is one of a dozen spills in its first year of operation.

"We don’t yet know the extent of the damage from this latest tar sands spill, but what we do know is that this is not the first time this pipeline has spilled toxic tar sands, and it won't be the last," Sierra Club Beyond Dirty Fuels associate director Catherine Collentine said.

"We've always said it's not a question of whether a pipeline will spill, but when, and once again TC Energy has made our case for us," Collentine said.

Greenpeace USA tweeted of the spill: "Brought to you by the corporation that wants to build the much larger #KXL pipeline and have it cut right through the Midwest," referring to the Keystone KL.

Sen. Bernie Sanders, I-Vermont, who is running for the Democratic presidential nomination, in a tweet Thursday accused President Donald Trump of ignoring science and putting profits ahead of the environment.

"As president, I will shut down the Keystone Pipeline that should never have been built in the first place," Sanders said.

CORRECTION (Nov. 1, 2019, 11:29 a.m. ET): An earlier version of this article misstated the name of the county where the leak occurred. It is Walsh County, not Wash. It also misstated the year in which construction on the pipeline is slated to begin. It’s 2020, not 2010.