BISMARCK, N.D. (AP) — TC Energy's Keystone pipeline leaked an estimated 383,000 gallons of oil in northeastern North Dakota, state regulators said Thursday.

Crews on Tuesday shut down the pipeline that carries tar sands oil from Canada through seven states after the leak was discovered, said Karl Rockeman, North Dakota's water quality division director. It remained closed Thursday.

The Calgary, Alberta-based company formerly known as TransCanada said in a statement the leak affected about 22,500 square feet of land near Edinburg, in Walsh County.

The company and regulators said the cause was being investigated.

"Our emergency response team contained the impacted area and oil has not migrated beyond the immediately affected area," the company said in a statement.

North Dakota regulators were notified late Tuesday night of the leak. Rockeman said some wetlands were affected, but not any sources of drinking water.

Regulators have been at the site since Wednesday afternoon monitoring the spill and cleanup, he said.

Crude began flowing through the $5.2 billion pipeline in 2011. It's 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.

It can handle about 23 million gallons daily.

The pipeline spill and shutdown comes as the company seeks to build the $8 billion Keystone XL pipeline that would carry tar sands oil from Alberta, Canada, to refineries in Texas. The proposed Keystone XL pipeline has drawn opposition from people who fear it will harm the environment.

President Donald Trump issued a federal permit for the expansion project in 2017, after it had been rejected by the Obama administration.

Together, the massive Keystone and Keystone XL network would be about five times the length of the trans-Alaska oil pipeline.

The original Keystone has experienced problems with spills in the past, including one in 2011 of more than 14,000 gallons of oil in southeastern North Dakota, near the South Dakota border. That leak was blamed on valve failure at a pumping station.

Another leak in 2016 prompted a weeklong shutdown of the pipeline. The company estimated that just under 17,000 gallons of oil spilled onto private land during that leak. Federal regulators said an "anomaly" on a weld on the pipeline was to blame. No waterways or aquifers were affected.

In 2017, the pipeline leaked an estimated 407,000 gallons of oil onto farmland in northeastern South Dakota, in a rural area near the North Dakota border. The company had originally put the spill at about 210,000 gallons.

Federal regulators said at the time the Keystone leak was the seventh-largest onshore oil or petroleum product spill since 2010. Federal investigators said the pipeline was likely damaged during installation during 2008 and may have occurred when a vehicle drove over the pipe, causing it to weaken over time.

North Dakota's biggest spill , and one of the largest onshore spills in U.S. history, came in 2013, when 840,000 gallons (3.1 million liters) spilled from a Tesoro pipeline in the northwestern part of the state. The company spent five years and nearly $100 million cleaning it up.

The Sierra Club said the latest spill was an example of why the Keystone XL should not be built.

"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."

More From KGAB