An underground pipeline spewed thousands of gallons of crude oil Thursday near the Southern California coast but the foul-smelling goo was contained in a lengthy stretch of ravine and never reached nearby beaches.

About 29,000 gallons of oil spilled and flowed at least a quarter-mile in the canyon near Ventura, fire authorities said.

Resident Kirk Atwater said he called 911 after smelling and hearing the flowing crude.

"We started getting this horrendous smell and I knew right away what it was," he said.

Atwater, 56, said he went up the canyon on his motor scooter and found the oil gushing from an above-ground box that he surmised covers equipment.

"It was just pouring out like water coming out of a fire hydrant," he said.

He said he found a posted phone number and reported the leak to the pipeline company.

Fire crews responded and a pump house operating the line was shut down. Firefighters built a dam of dirt to keep the oil from moving farther.

The oil left a black stain down the brush- and tree-filled arroyo.

The line operator, Crimson Pipeline, estimated that at most 25,200 gallons were released, said spokeswoman Kendall Klingler. The cause was under investigation, she said.

The spill was the 11th for Crimson since 2006, with prior releases totaling 313,000 gallons of crude and causing $5.9 million in property damage, according to accident reports submitted by the company to federal regulators and reviewed by The Associated Press.

The largest was a 2008 spill of 280,000 gallons — one of three blamed on an equipment failure. All the spills occurred in Southern California.

The leak Thursday occurred near a valve on an underground line that runs from Ventura to Los Angeles. The line was closed for maintenance and crews had replaced that valve the day before, Klingler said.

The line contained a total of 84,000 gallons of crude.

"The initial concern was that there was a chance that it could have made its way further, but the spill was contained very early on and a lot of damage has been mitigated because of that," Klingler said.

The spill occurred in the Hall Canyon area and flowed into the Prince Barranca, a ravine that ends near the Ventura Pier. Initial projections that up to 210,000 gallons may have spilled were later reduced.

The oil was produced by a company called Aera Energy.

Firefighters had a training exercise with Crimson and an oil spill cleanup company about two weeks ago, including building a dam as was done Thursday, Ventura County fire Capt. Scott Quirarte said.

Four of the prior Crimson spills were blamed on corrosion and two on excavation damage. An electrical arc from a power pole was the cause of another leak.

Klinger defended the company's safety record and said most of the past spills were caused by third parties.

The company says its California network traverses about 1,000 miles and moves nearly 200,000 barrels — 8.4 million gallons — of oil daily.

The Crimson line is an intrastate pipe, meaning it does not cross out of California and is therefore outside of federal jurisdiction, said Artealia Gilliard, a spokeswoman for the U.S. Pipeline and Hazardous Materials Safety Administration.

Gilliard said the federal agency was sending personnel to assist on scene but the investigation would be led by California officials.

The spill came 13 months after more than 120,000 gallons of oil spilled on the coast of neighboring Santa Barbara County. Some of the crude flowed into the ocean at Refugio State Beach and killed birds and sea lions.

That pipeline, owned by Plains All American Pipeline, was found to have corrosion.

Federal regulators said last month that Plains failed to prevent corrosion in its pipes, detect the rupture or respond swiftly as crude streamed toward the ocean on May 19, 2015.

The report was issued just two days after Plains was indicted in Santa Barbara County Superior Court on 46 criminal counts, including four felonies of polluting state waters and three dozen misdemeanors of harming wildlife.