TransCanada Corp. shut part of its Keystone oil pipeline system after a 5,000-barrel leak in South Dakota, the company said on Thursday, four days before neighboring Nebraska was set to decide on the company's long-delayed Keystone XL pipeline.

Opponents of TransCanada's proposed Keystone XL pipeline seized on the spill, saying it highlighted the risks posed by the XL project — which has become a symbol for environmentalists of fossil-fuel pollution and global warming.

TransCanada said in a statement it discovered the leak in the town of Amherst at 6 a.m. on Thursday after systems detected a drop in pressure, and that it was working with authorities as it investigates the cause.