TEHRAN, Iran (AP) - ( By NASSER KARIMI and AMIR VAHDAT ) A powerful 7.3 magnitude earthquake near the Iraq-Iran border killed over 400 people across both countries, sent residents fleeing their homes into the night and was felt as far away as the Mediterranean coast, authorities said Monday.
Iran's western Kermanshah province bore the brunt of the temblor Sunday night, with authorities saying the quake killed 407 people in the country and injured 6,700. Kermanshah is a rural, mountainous region where residents rely mainly on farming.
In Iraq, the earthquake killed at least seven people and injured 535, all in the country's northern Kurdish region, according to Iraq's Interior Ministry.
The quake was centered 19 miles (31 kilometers) outside the eastern Iraqi city of Halabja, according to the most recent measurements from the U.S. Geological Survey. It struck at 9:48 p.m. Iran time, just as people began retiring for the night.
It could be felt on the Mediterranean coast, some 660 miles (1,000 kilometers) away.
The earthquake struck 23.2 kilometers (14.4 miles) below the surface, a shallow depth that can amplify damage. Magnitude 7 earthquakes can be highly destructive.
Iranian social media and news agencies showed images and videos of people fleeing their homes. More than 100 aftershocks followed.
The quake's worst damage appeared to be in the town of Sarpol-e-Zahab in Kermanshah province, which sits in the Zagros Mountains that divide Iran and Iraq.
Kokab Fard, a 49-year-old housewife in Sarpol-e-Zahab, said she fled 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 out into the alley after the first shock. "I tried to get back to pick up some stuff but it totally collapsed in the second wave," Mohammadi said.
Sarpol-e-Zahab residents said the power and water were out and telephone and cellphone lines were spotty.
Iran's Supreme Leader Ayatollah Ali Khamenei offered his condolences on Monday morning and urged rescuers and government agencies to do all they could to help those affected, state media reported. President Hassan Rouhani is scheduled to tour earthquake-damaged areas Tuesday.
The semi-official ILNA news agency said at least 14 provinces in Iran had been affected by the earthquake. Behnam Saeedi, a spokesman for the country's crisis management headquarters, told two semi-official news agencies that casualty figures stood at 407 killed and 6,700 injured.
In Iraq, Prime Minister Haider al-Abadi issued a directive for the country's civil defense teams and "related institutions" to respond to the natural disaster. Brig. Gen. Saad Maan, an Interior Ministry spokesman, gave the casualty figures for Iraq.
The quake could be felt across Iraq, shaking buildings and homes from Irbil to Baghdad, where people fled into the streets of the capital.
Amina Mohammed, who survived the quake in 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 who stopped the stairs from entirely collapsing on us."
The Iraqi city of Halabja, closest to the epicenter, was the target of a 1988 chemical attack in which Saddam Hussein's troops killed some 5,000 people with mustard gas -- the deadliest chemical weapons attack ever against civilians.
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 the direction of the fault line. He said the Iraqi geological formations were better able to absorb the shocks.
However, the temblor caused visible damage to the dam at Darbandikhan, which 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.
Turkey dispatched emergency aid to northern Iraq as officials expressed their "deep sadness" at the tragedy. Prime Minister Binali Yildirim said his country took immediate action to provide medical and food aid to northern Iraq.
Kerem Kinik, the Turkish Red Crescent's vice president, told The Associated Press from Habur border crossing that 33 aid trucks were en route to the northern Iraqi city of Sulaimaniyah, carrying 3,000 tents and heaters, 10,000 beds and blankets as well as food.
A Turkish military cargo plane arrived in Iraq as the official Anadolu news agency reported multiple dispatches by Turkey's disaster agency. Ankara also said it would help Iran if Tehran requests assistance.
Relations between Iraq's semi-autonomous Kurdish region and Turkey were strained following the Iraqi Kurds' September independence referendum.
Turkey's President Recep Tayyip Erdogan said his country stands with the region in difficult times and wished the Iraqi and Iranian people a speedy recovery. Speaking en route to Sochi, Russia, Erdogan said a convoy of 50 aid trucks has crossed the border into Iraq. Pakistan also extended its condolences for the loss of life and injuries suffered by "our Iranian and Iraqi brethren."
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.
Associated Press writers Jon Gambrell in Dubai, United Arab Emirates; Susannah George in Irbil, Iraq; Balint Szlanko in Darbandikhan, Iraq; Zeynep Bilginsoy in Istanbul; Zarar Khan in Islamabad and Sinan Salaheddin in Baghdad contributed to this report.