Teams of Iranian rescuers dug through rubble in a hunt for survivors on Monday after a major earthquake struck the Iran-Iraq border, killing at least 415 people and injuring thousands.
The 7.3-magnitude quake rocked a border area 30 kilometres south-west of Halabja in Iraqi Kurdistan at around 9.20pm local time (10.20pm UAE) on Sunday, the US Geological Survey said.
Many people would have been at home when the quake hit in Iran's western province of Kermanshah, where authorities said it killed at least 407 people and injured 6,700.
Across the border in more sparsely populated areas of Iraq, the health ministry said eight people had died and several hundred were injured.
Iraq's Red Crescent reported nine dead and more than 400 injured.
As dusk approached on Monday, tens of thousands of Iranians were forced to sleep outside in the cold for a second night as authorities scrambled to provide them with aid.
Some had spent Sunday night outdoors after fleeing their homes in the mountainous cross-border region, huddling around fires at dawn as authorities sent in help.
"People's immediate needs are firstly tents, water and food," said the head of Iran's elite Revolutionary Guards, Major General Mohammad Ali Jafari.
"Newly constructed buildings … held up well, but the old houses built with earth were totally destroyed," he told state television during a visit to the affected region.
Hundreds of ambulances and dozens of army helicopters reportedly joined the rescue effort after Iranian supreme leader Ayatollah Ali Khamenei ordered the government and armed forces to mobilise "all their means".
Foreign media organisations were not given authorisation to visit the scene of the disaster on Monday but officials said they were setting up relief camps for the displaced.
Iran's emergency services chief Pir Hossein Koolivand said landslides had cut off roads to affected villages, impeding the access of rescue workers.
But by late afternoon, officials said all roads in Kermanshah province had been re-opened, though the worst-affected town of Sar-e Pol-e Zahab remained without electricity, according to state television.
Officials said 22,000 tents, 52,000 blankets and tonnes of food and water had been distributed.
The official IRNA news agency said 30 Red Crescent teams had been sent to the quake zone.
After initially pinning the quake's epicentre inside Iraq, the USGS then placed it across the border in Iran on Monday morning.
Iran's Sar-e Pol-e Zahab, home to some 85,000 people close to the border, was the worst hit with at least 236 dead.
At dawn, buildings in the town stood disfigured, their former facades now rubble on crumpled vehicles.
In an open space away from wrecked housing blocks, men and women, some wrapped in blankets, huddled around a campfire.
Iranian media reported that a woman and her baby were pulled alive from the rubble.
The towns of Eslamabad and Qasr-e Shirin were also affected, while the tremor shook several western Iranian cities including Tabriz.
In Dalahoo County, several villages were totally destroyed, an official told the private Tasnim news agency.
In Iraq, the health ministry said the quake had killed seven people in the northern province of Sulaimaniyah and one in Diyala province to its south.
More than 500 people were injured in both provinces and the nearby province of Kirkuk.
Footage posted on Twitter showed panicked people fleeing a building in Sulaimaniyah as windows shattered at the moment the quake struck. Images from the nearby town of Darbandikhan showed walls and concrete structures that had collapsed.
Iraqi Kurd Nizar Abdullah, along with neighbours, spent the night sifting through the ruins of a two-storey home next door after it crumbled into concrete debris.
"There were eight people inside," the 34-year-old said.
Some family members managed to escape, but "neighbours and rescue workers pulled out the mother and one of the children dead from the rubble".
The quake, which struck at a relatively shallow depth of 23 kilometres, was felt for about 20 seconds in Baghdad, and for longer in other provinces of Iraq.
Iraqi health authorities said they treated dozens of people in the aftermath, mostly for shock.
It was also felt in the UAE, as well as in southeastern Turkey, with residents in the town of Diyarbakir reported to have fled their homes.
The quake struck along a 1,500-kilometre fault line between the Arabian and Eurasian tectonic plates, which extends through western Iran and northeastern Iraq.
The area sees frequent seismic activity.
In 1990, a 7.4-magnitude quake in northern Iran killed 40,000 people, injured 300,000 and left half a million homeless, reducing dozens of towns and nearly 2,000 villages to rubble in just seconds.
Thirteen years later, a catastrophic quake flattened swathes of the ancient southeastern Iranian city of Bam, killing at least 31,000.
Iran has experienced at least two major quake disasters since, one in 2005 that killed more than 600 and another in 2012 that killed some 300.