Villagers evacuated because of the risk of flooding from a reservoir have been told it is safe to return home.
Police said a controlled release of water from a disused quarry at Pennal, Gwynedd, had eased pressure on a wall.
Earlier, police were trying to evacuate 600 people from the village after a slight breach in the reservoir's dam.
Police said a measured release of water had been undertaken to reduce it to a safe level, and a trench created to allow the water to dissipate safely.
'Very serious situation'
The emergency services said the operation, involving six million gallons of water, had been successful.
Gwyn Jones, of North Wales Fire and Rescue Service, said: "Over the course of the day, we've been able to undertake two releases of water from the reservoir.
"We were closely monitoring the level of the river, and everything was satisfactory after those two releases.
"Subsequently, contractors and the landowner have created a permanent channel in the reservoir which is allowing the water to dissipate naturally and at a steady rate.
"Based on that information and survey from specialist pump operators on the scene, we were able to give the advice through North Wales Police that residents were able to return to their homes."
He said the pressure on the reservoir was "immense" and public safety was "paramount".
"We have managed to avert a very serious situation," he said.
North Wales Police earlier said that all villagers were being advised to leave Pennal as a precautionary measure.
Police said the evacuation followed a slight breach in the dam - believed to be due to a landslide - which had caused a small amount of water to escape.
Some residents were transported to Machynlleth, just over the border in Powys, while others relocated themselves to a leisure resort above the village or made alternative plans.
Villager Shem ap Geraint said residents had gone to the leisure resort as they wanted to stay close by. He described the scene earlier in Pennal as "manic".
Council workers, the local water board, North Wales Fire and Rescue Service and officers from North Wales Police were at the scene working to stabilise the situation.
Supt Andy Jenks-Gilbert had said a crack had been discovered in the dam wall, causing a small amount of water to escape.
He said that had the wall been completely breached the contents of the reservoir would have gone into the river which flows through Pennal, about half a mile away.
The reservoir is not man-made and has been created by the build-up of water at a derelict quarry as waste slate formed a natural dam.
Some residents from Pennal went Machynlleth Leisure Centre.
Assistant manager Aled Davies said earlier on Sunday: "The people are in good spirits. We are looking after them, they are having refreshments and watching TV."
The evacuation at Pennal came as the clean-up operation continued in Ceredigion and parts of Powys.
Villages were flooded by 5ft (1.5m) of water with record high river levels in parts of Aberystwyth on Saturday.
Caravan parks and villages near Aberystwyth were inundated by floodwater when twice as much rain fell in 24 hours than normally falls in the area in the whole of June.
Environment Agency Wales was continuing to provide flood alert updates online.