The storm was lashing the northern California coast last Tuesday, inundating the Napa Valley's famous vineyards, plugging interstate highways with rivers of mud and forcing thousands of lowland residents to flee their homes with whatever they could carry.

But 100 miles inland, in a helicopter above the American River, federal Bureau of Reclamation officials were looking down at a problem that could make the coastal devastation look minor by comparison.

A temporary cofferdam straddles the river there, marking the site of the Auburn Dam, an uncompleted project that has been on hold since it was disclosed that a major earthquake fault runs through the area. Behind the cofferdam was more than 40 billion gallons of water -- far more than the structure was designed to hold.

While the officials watched in fascination and dread, the rising water lapped over the top, nibbling at the edges of a spillway plug inserted in the cofferdam to protect it against this kind of storm.

Slowly at first, then in a rush, the plug collapsed and broke apart.

Tons of water roared through the opening and headed downstream to the Folsom Dam -- which wasn't designed to hold it, either.

Downstream of Folsom Dam lies Sacramento, the capital of California, with a population of 275,000.

"Things became very tense," said Chuck Abraham of the bureau's Sacramento office. "You felt like you were working on the razor's edge. We knew the plug was going to go. It was just a question of when."

For more than four days, hoping for the best and fearing the worst, bureau officials released more water from Folsom than the 35 miles of flood levees that protect Sacramento were designed to carry. "The actual release was 130,000 cubic feet per second," Abraham said. "The levees were designed for 115,000."

The levees held.

Linda, Calif., 40 miles north of Sacramento on the Yuba River, wasn't so lucky. A major levee there collapsed under the force of flood waters, forcing about 10,000 residents there alone to scramble for the roofs of their cars and homes.

But those were the breaks in California last week, where crossed fingers and prayers backed up the massive concrete dams and earthen dikes that serve to protect the state -- most of the time -- from the fury of floods.

This time, 5 persons drowned and property damage rose above $300 million. The state might still be considered fortunate, however, as the tense vigil over Folsom Dam highlighted the fragility of the multibillion-dollar system of dams, canals and embankments that form California's main line of defense against the occasionally rampaging forces of nature.

"These were untested waters, so to speak," said the Corps spokesman. "We were lucky."

The source of the trouble was a tropical storm -- laden with moisture from the Pacific -- that swept in from the coast above San Francisco and hit Sacramento mid-center. Within six days, some areas of northern California got about half as much rain as would normally be expected in an entire year.

The rain was so heavy that bureau spokesman talk in terms of feet, not inches.

"The area above Folsom got three feet of precipitation in a six-day period," Abraham said. In higher elevations, where the moisture fell as snow, it was eight feet and nine feet.

The inundation put the greatest pressure on a small number of major dams in the storm's path. For six days, federal and state officials worked around the clock while the rain drummed down, turning rivulets into creeks, creeks into torrents and placid reservoirs into potential bombs restrained by curtains of concrete.

While the real nail-biter was Folsom, federal officials also worried about the Shasta Dam north of Redding, which stores the bulk of the water that is channeled south through the Central Valley Project in the dry summer months.

"That's our most tense situation now, although it seems like a cake walk compared to Folsom," Abraham said. Shasta holds 1.3 million acre-feet of water, enough to supply a city of 250,000 people for 445 years -- or put 1.3 million acres of land under a foot of water.

The storm was less intense in far northern California, but Shasta is fed by a larger watershed. According to Abraham, the situation has stabilized, with about as much water being released from Shasta as is being received.

For state officials, the dam of most concern was Oroville, built after two catastrophic floods on the Feather River killed 64 people in Yuba City in 1955. Because of the levee break near Linda, officials were forced to reduce discharges from Oroville and nearby Englebright in an effort to reduce water levels in the levee enough to allow repairs.

"It's not causing a problem now because we have a break in the weather," said Don Neudeck, a spokesman at the State Flood Control Center in Sacramento.

Officials cautiously predict that the worst is over, with little more than sprinkles in the forecast and colder air keeping the high-elevation snowpack firmly frozen. The next critical period will come in the spring, when the snow dropped by the storms high in the Cascade and Sierra Nevada mountains begins to melt.

But with the sun peeking through and the dams intact, exhausted Bureau of Reclamation officials were able to find a small silver lining in the storm clouds that tried to wipe out California.

Until last week, the state was well into its second straight year of below-normal winter precipitation, prompting fears that it might not have enough water in storage to fulfill heavy demands for agriculture and urban consumption this summer.

"Most of the reservoirs are way above normal precipitation and storage now," said bureau spokesman Jerry Harrell. "The measurements look very, very good."