GOLETA, Calif. -- A broken pipeline spilled 21,000 gallons of crude oil into the ocean before it was shut off Tuesday, creating a slick stretching about 4 miles along the central California coastline, the U.S. Coast Guard said.

Authorities responding to reports of a foul smell near Refugio State Beach around noon found a half-mile slick already formed in the ocean, Santa Barbara County Fire Capt. Dave Zaniboni said. They traced the oil to the onshore pipeline that spilled into a culvert running under the U.S. 101 freeway and into a storm drain that empties into the ocean.

An oil slick is seen along the coast of Refugio State Beach in Goleta, California, United States, May 19, 2015. REUTERS/Lucy Nicholson

The pipeline was shut off about three hours later but by then the slick stretched four miles and 50 yards into the water.

Get Breaking News Delivered to Your Inbox

The 24-inch pipeline is owned by Plains All American Pipeline, which said it shut down the flow of oil and the culvert carrying the oil to the ocean was blocked.

"Plains deeply regrets this release has occurred and is making every effort to limit its environmental impact," the company said in a statement.

A beach up the coast from Santa Barbara is now closed, reports CBS News correspondent Ben Tracy from Refugio State Beach. Campers in the area were forced to evacuate.

"Just a few hours ago it was a beautiful beach and now it's a mess," one camper said.

The Coast Guard, county emergency officials and state parks officials were cleaning up the spill. Boats from the nonprofit collective Clean Seas also were providing help but were having trouble because so much of the oil was so close to the shore, Coast Guard spokeswoman Jennifer Williams said. About 850 gallons of oil have been recovered from the water, Williams said.

"Were gonna look for the best way, the most environmentally friendly way to mitigate the oil spill and get the beach back to its pristine condition," Williams said.

The accident occurred on the same stretch of coastline as a 1969 spill that at the time was the largest ever in U.S. waters and is credited for giving rise to the American environmental movement. Several hundred thousand gallons spilled from a blowout on an oil platform and thousands of sea birds were killed along with many marine mammals.

The stretch of coastline about 20 miles northwest of the pricey real estate of Santa Barbara still is home to offshore oil rigs and small amounts of tar and seepage regularly show up on beaches.

The spill is largest in years and the Santa Barbara-based Environmental Defense Center said to have it occur in "a sensitive and treasured environment is devastating to watch." The group expressed special worry for the many species of whale that migrate through the area.

It was unclear how long the cleanup would take and whether Refugio and other areas would be reopened in time for Memorial Day weekend.

Offshore cleanup was suspended for the night, and the Coast Guard said a morning flyover would allow them to get a better sense of the damage.

Overnight winds are expected to push the spill down the coast and closer to Santa Barbara.