A 7.3-magnitude earthquake has shaken the northern border region between Iran and Iraq, killing at least 396 people and injuring thousands more.
More than 7,000 people are also said to have been injured in the quake, the world's deadliest this year.
Most of those who died were in Iran's western Kermanshah province, where a search for survivors has started.
Nine more people died in Iraq, where residents fled from their homes into the streets in the capital, Baghdad.
"I was sitting with my kids having dinner and suddenly the building was just dancing in the air," a Baghdad resident, Majida Ameer, told Reuters news agency.
"I thought at first that it was a huge bomb. But then I heard everyone around me screaming: 'Earthquake!'"
In the latest updates from Iran:
Many homes in the predominantly Kurdish mountainous area are made of mud bricks and are vulnerable in quakes as large as Sunday's.
In Sarpol-e Zahab, a city of about 85,000 people, the sides of a number of tall buildings collapsed, forcing many people to spend the night outdoors in freezing conditions.
Rescue teams were being hampered by landslides, emergency workers said.
The quake hit at 21:18 local time (18:18 GMT) about 30km south-west of Halabja, near the north-eastern border with Iran, the US Geological Survey (USGS) said.
About 1.8 million people live within 100km of the epicentre, the UN estimates.
On the Iraqi side, the most extensive damage was in the town of Darbandikhan in the Kurdistan Region.
"The situation there is very critical," Kurdish Health Minister Rekawt Hama Rasheed told Reuters news agency.
Yaseen Abbas of the Iraqi Red Crescent Society told the BBC that 425 people had been wounded in the Iraqi Kurdistan region, where Turkey has already delivered aid.
The BBC's Rami Ruhayem, in the regional capital Irbil, said shaking there had lasted for more than a minute.
"For a few seconds at first it was barely detectable, I wasn't sure whether it was a minor tremor or just my imagination," he said. "But soon enough it was unmistakable as the building started swaying from side to side."
The earthquake struck at a relatively shallow depth of 23.2 km, and tremors were felt in Turkey, Israel and Kuwait.
In 2003, a 6.6-magnitude quake destroyed the historic city of Bam in south-east Iran, killing 26,000 people.
Sunday's quake is the deadliest to hit Iran since 2012. But it is only the sixth earthquake of magnitude-7.0 or more in 2017 - there were 16 last year and 19 the year before.
Analysis by Jonathan Amos, BBC Science Correspondent
Iran is one of those regions of the world that is all too familiar with quakes, and has experienced some very big tremors in the past.
In general terms, the big driver here is the clash between the Arabia and Eurasia tectonic plates. The former is pushing north by a couple of centimetres a year.
In the south-east of the country, the Arabia plate is actually pushing under the Eurasia plate, but in the north-west these great slabs rub directly against each other. The Zagros mountains are a result of all this compression.
Early reports indicate the quake occurred on a thrust fault. This means the crust on one side of the break in the rocks is moved vertically up and over the other side - which fits exactly with this general picture.
Geological agencies now produce immediate bulletins on the likely expected casualties. This modelling work is based on factors such as the size of the quake, population density and what is known about local construction methods. It's inexact work, but the first bulletins suggested this event could produce many hundreds of deaths and perhaps thousands of injured individuals.