TEHRAN, Iran -- Rescuers dug with their bare hands Monday through the debris of buildings brought down by a powerful earthquake that killed more than 400 people in the once-contested mountainous border region between Iraq and Iran, with nearly all of the victims in an area rebuilt since the end of the ruinous 1980s war.
Sunday night's magnitude 7.3 earthquake struck about 19 miles (31 kilometers) outside the eastern Iraqi city of Halabja, according to the most recent measurements from the U.S. Geological Survey. It hit at 9:48 p.m. Iran time, just as people were going to bed.
The worst damage appeared to be in the Kurdish town of Sarpol-e-Zahab in the western Iranian province of Kermanshah, which sits in the Zagros Mountains that divide Iran and Iraq.
Residents fled into the streets as the quake struck, without time to grab their possessions, as apartment complexes collapsed into rubble. Outside walls of some complexes were sheared off by the quake, power and water lines were severed, and telephone service was disrupted.
Residents dug frantically through wrecked buildings for survivors as they wailed. Firefighters from Tehran joined other rescuers in the desperate search, using dogs to inspect the rubble.
The hospital in Sarpol-e-Zahab was heavily damaged, and the army set up field hospitals, although many of the injured were moved to other cities, including Tehran.
It also damaged an army garrison and buildings in the border city and killed an unspecified number of soldiers, according to reports.
Iran's Supreme Leader Ayatollah Ali Khamenei immediately dispatched all government and military forces to aid those affected.
Many of the heavily damaged complexes in Sarpol-e-Zahab were part of construction projects under former hard-line President Mahmoud Ahmadinejad. The newly homeless slept outside in cold, huddled around makeshift fires for warmth, wrapped in blankets - as were the dead.
The quake killed 407 people in Iran and injured 7,156 others, Iran's crisis management headquarters spokesman Behnam Saeedi told state TV. He said most were treated for minor injuries and released, with fewer than 1,000 still hospitalized.
The number of dead came from the provincial forensic department based on death certificates issued. Some reports said authorities warned that unauthorized burials without certification could mean the death toll was higher.
In Iraq, the earthquake killed at least seven people and injured 535 others, all in the country's northern, semiautonomous Kurdish region, according to its Interior Ministry.
The disparity in the fatality figures immediately drew questions from Iranians, especially because so much of the town was new.
The earthquake struck 14.4 miles (23.2 kilometers) below the surface, a shallow depth that can have broader damage. Magnitude 7 earthquakes on their own are capable of widespread, heavy damage.
The quake caused Dubai's skyscrapers to sway and could be felt 1,060 kilometers (660 miles) away on the Mediterranean coast. Nearly 120 aftershocks followed.
Kokab Fard, a 49-year-old housewife in Sarpol-e-Zahab, said she could only flee empty-handed when her apartment complex collapsed.
"Immediately after I managed to get out, the building collapsed," Fard said. "I have no access to my belongings."
Reza Mohammadi, 51, said he and his family ran into the alley following the first shock.
"I tried to get back to pick some stuff, but it totally collapsed in the second wave," Mohammadi said.
Khamenei offered his condolences as President Hassan Rouhani's office said Iran's elected leader would tour the damaged areas Tuesday. Authorities also set up relief camps and hundreds lined up to donate blood in Tehran, though some on state television complained about the slowness of aid coming.
Sarpol-e-Zahab fell to the Iraqi troops of dictator Saddam Hussein during his 1980 invasion of Iran, which sparked the eight-year war between the two countries that killed 1 million people. Though clawed back by Iran seven months later, the area remained a war zone that suffered through Saddam's missile attacks and chemical weapons.
After the war, Iran began rebuilding the town. It also was part of Ahmadinejad's low-income housing project, which aided the Holocaust-questioning hard-liner's populist credentials but also saw homes cheaply constructed.
Under the plan dubbed as Mehr or "kindness" in Farsi, some 2 million units were built across the country, including hundreds in Sarpol-e Zahab. Many criticized the plan, warning that the low-quality construction could lead to a disaster.
"Before its 10-year anniversary, Mehr buildings have turned into coffins for its inhabitants," the reformist Fararu news website wrote Monday.
In Iraq, the quake shook buildings from Irbil to the capital of Baghdad, where people fled into the streets.
Iraqi seismologist Abdul-Karim Abdullah Taqi, who runs the earthquake monitoring group at the state-run Meteorological Department, said the main reason for the lower casualty figure in Iraq was the angle and direction of the fault line in this particular quake, as well as the nature of the Iraqi geological formations that could better absorb the shocks.
Amina Mohammed of Darbandikhan, Iraq, said she and her sons escaped their home as it collapsed around them.
"I think it was only God that saved us," she said. "I screamed to God and it must have been him to stop the stairs from entirely collapsing on us."
Residents were clearing the rubble from the streets of Darbandikhan, about 10 kilometers from the Iranian border.
The quake did visible damage to a dam at Darbandikhan that holds back the Diyala River.
"There are horizontal and vertical cracks on the road and in the body of the dam and parts of the dam sank lower," said Rahman Hani, the director of the dam.
No dams were damaged in Iran, the government in Tehran said.
Halabja, closest to the epicenter, is notorious for the 1988 chemical attack in which Saddam killed some 5,000 people with mustard gas - the deadliest chemical weapons attack ever against civilians.
Turkey dispatched emergency aid to northern Iraq as officials expressed their "deep sadness" at the disaster. Prime Minister Binali Yildirim said his country acted immediately to provide medical and food aid to northern Iraq.
Kerem Kinik, the Turkish Red Crescent's vice president, told The Associated Press from the Habur border crossing that 33 aid trucks were en route to Sulaimaniyah, Iraq, carrying 3,000 tents and heaters, 10,000 beds and blankets, as well as food.
Relations between Iraq's semi-autonomous Kurdish region and Turkey were strained following the Iraqi Kurds' September independence referendum.
Pakistan's government also extended condolences for the loss of life and injuries suffered by "our Iranian and Iraqi brethren."
Pope Francis offered prayers for the dead and urged strength to rescue crews looking for survivors.
Iran sits on many major fault lines and is prone to near-daily quakes. In 2003, a magnitude 6.6 earthquake flattened the historic city of Bam, killing 26,000 people. The last major casualty earthquake in Iran struck in East Azerbaijan province in August 2012, killing over 300 people.
More than 400 dead from earthquake in Iran-Iraq border area