More than 180,000 people in northern California have been told to evacuate their homes after both overflow channels at the tallest dam in the US were found to be damaged.
The emergency spillway of the 770ft (230m) tall Oroville Dam was close to collapse, officials said.
The excess water has now stopped flowing.
However, late on Sunday, Butte County Sheriff Kory Honea said the evacuation orders remained in place.
Water levels in the reservoir have risen following heavy rain and snow after years of severe drought.
It is the first time that Lake Oroville, which lies 65 miles (105km) north of Sacramento, has experienced such an emergency in the dam’s near 50-year history.
In a statement posted on social media on Sunday afternoon, Mr Honea ordered residents to evacuate, repeating three times that it was “NOT a drill”.
The California Department of Water Resources warned that the emergency spillway next to the dam was “predicted to fail”.
Residents of Oroville, a town of 16,000 people, were told to head north.
There was gridlock on roads heading out of the town, with some evacuees complaining that they should have been given more warning.
California Fire Incident commander, Kevin Lawson, said officials stood by the decision to evacuate residents, rather than risk thousands of lives.
He said if the situation was not dealt with they were looking at “a 30ft wall of water coming out of the lake”.
Butte County’s official Twitter feed shared news of emergency shelters, and reported that many hotels were fully booked in the wider area.
One local resident, Javier Santiago, moved his family to the dam’s visitor centre, which sits at the top of the structure and away from the flow of water.
“We’re going to sleep in the car,” he told Reuters news agency, adding that he had packed blankets, pillows and a little food for himself, his wife and their two children.
Gurtej Singh, a manager at a Sikh centre in Sacramento, said the local mayor’s office contacted his organisation to ask if they would host evacuees.
“We, in turn, put a call out to members of our community to see if they could provide food, bedding etc, so that around 50 people could stay at our centre,” he said.
Several hours after the evacuation order, the emergency spillway was still standing.
The California Department of Water Resources said it was releasing as much as 100,000 cubic feet (2,830 cubic metres) of water per second from the main spillway to try to lower the lake’s level and relieve the pressure.
Helicopters were dispatched to drop boulders to try to block the eroded area next to the spillway.
Mr Lawson stressed that there was no danger of the entire dam collapsing.
It rises higher than the spillways, so water was not close to cascading over its top.
Sheriff Honea said that the evacuation was declared to avoid a “worst-case scenario”.
He added that no decision had been made as to when people would be allowed back into their homes, as the authorities were still assessing the risks.
Doug Carlson, from the California Department of Water Resources, told the BBC that the situation was looking positive, as the lake level had dropped during the night after the emergency measures were taken.
“That’s very good news for the people downstream,” he said.
Last week, water levels in the reservoir rose sharply and the dam’s main spillway, also known as an overflow channel, was found to be damaged.
On Saturday, the water rose even higher, and the emergency spillway was activated for the first time since the dam’s completion in 1968.
However, this secondary slipway was also found to be damaged.
After a long period of drought, California has been experiencing heavy rain and increased snowfall, which has led to flooding and mudslides.
On Friday, California Governor Jerry Brown asked the Federal Emergency Management Agency to declare a major disaster.