An oil spill from a ruptured onshore pipeline that fouled beaches and threatened wildlife along a scenic stretch of the California coast spread across 9 miles of ocean Wednesday and officials said up to 105,000 gallons may have leaked out.

Up to a fifth of that amount -- 21,000 gallons -- reached the sea, according to estimates.

Federal regulators were investigating the leak as workers in protective suits raked and shoveled stinky black goo off the beaches, and boats towed booms into place to corral the two slicks off the Santa Barbara coast.

The coastline was the scene of a much larger spill in 1969 -- the largest in U.S. waters at the time -- that is credited with giving rise to the American environmental movement.

The chief executive of the company that runs the pipeline, Plains All American Pipeline LP, was at the site of the spill Wednesday and apologized for it.

"We deeply, deeply regret that this incident has occured at all," Chairman and CEO Greg L. Armstrong said at a news conference. "We apologize for the damage that it's done to the wildlife and to the environment and we're very sorry for the disruption and inconvenience that it's caused on the citizens and the visitors to this area."

Crude was flowing through the pipe at 54,600 gallons an hour at the time of the leak Tuesday, the company said. Company officials didn't say how long it leaked before it was discovered and shut down, or discuss the rate at which oil escaped.

Federal regulators from the Department of Transportation, which oversees oil pipeline safety, investigated the leak's cause, the pipe's condition and the potential regulatory violations.

The 24-inch pipe built in 1991 had no previous problems and was thoroughly inspected in 2012, according to Plains. The pipe underwent similar tests about two weeks ago, though the results had not been analyzed yet.

There was no estimate on the cost of the cleanup or how long it might take.

A combination of soiled beaches and pungent stench of petroleum caused state parks officials to close Refugio State Beach and El Capitan State Beach, both popular campgrounds west of Santa Barbara, over the Memorial Day weekend.

Still, tourists were drawn to pull off the Pacific Coast Highway to eye the disaster from overlooking bluffs.

"It smells like what they use to pave the roads," said Fan Yang, of Indianapolis, who was hoping to find cleaner beaches in Santa Barbara, about 20 miles away. "I'm sad for the birds -- if they lose their habitat."

The early toll on wildlife included two oil-covered pelicans, said spokeswoman Melinda Greene. Biologists were seen counting dead fish and crustaceans along sandy beaches and rocky shores.

The state Department of Fish and Wildlife closed fishing and shellfish harvesting for a mile east and west of Refugio beach and it deployed booms to protect the nesting and foraging habitat of the snowy plover and the least tern, both endangered shore birds.

The coastal area is habitat for seals, sea lions and whales, which are now migrating north through the area.

Gov. Jerry Brown on Wednesday night declared a state of emergency because of the spill, a move that frees up additional state funding and resources to help in the cleanup efforts.

Also Wednesday, Santa Barbara County District Attorney Joyce Dudley said her office, along with the state attorney general, is investigating the pipeline spill for possible criminal prosecution or a finding of civil liability.

Environmental groups used the spill as an opportunity to take a shot at fossil fuels and remind people of the area's notoriety with oil spills.

"Big Oil comes with big risks -- from drilling to delivery," said Bob Deans, spokesman for the Natural Resources Defense Council. "Santa Barbara learned that lesson over 40 years ago when offshore drilling led to disaster."

Large offshore rigs still dot the horizon off the coast, pumping crude to shore and small amounts of tar from natural seepage regularly show up on beaches. The leak occurred in a pipe that was carrying crude from an onshore facility toward refineries further down the chain of production.

The oil spilled into a culvert running under a highway and into a storm drain that emptied into the ocean.

The spill was not expected to affect gas prices, even though the pipeline was out of operation for now, said Tom Kloza, global head of energy at the Oil Price Information Service.

In fact, Californians probably will see high prices drop a bit because the wholesale price of gas has dropped 60 cents a gallon in the past week, Kloza said.