More than 400 people were killed when a powerful 7.3 magnitude earthquake struck near Iraq-Iran boarder on Sunday, sending residents fleeing as thousands of residents were left injured, officials said on Monday.

The quake was centered 19 miles outside the eastern Iraqi city of Halabja and struck around 9:48 p.m. Iran time. Residents were retiring for the night at the time. Iran's western Kermanshah province, a rural mountainous region, bore the brunt of the temblor, with Iran's state-run news agency reporting the quake killed 407 people in the country and injured another 6,700.

In Iraq, the earthquake killed at least seven people and injured 535 there, all in the country's northern, semiautonomous Kurdish region, according to Iraq's Interior Ministry. 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 in this particular quake, as well as the nature of the Iraqi geological formations that could better absorb the shocks.

More than 100 aftershocks were felt after the quake that could be felt on the Mediterranean coast — about 660 miles away. It struck at a depth of 14.4 miles, a shallow depth that can cause broad damage. Magnitude 7 earthquakes on their own are capable of widespread, heavy damage. Iranian social media and news agencies showed images and videos of people fleeing their homes. 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 out into the alley following the first shock he felt.

"I tried to get back to pick some stuff but it totally collapsed in the second wave," Mohammadi said.

The semi-official ILNA news agency said at least 14 provinces in Iran had been affected by the earthquake. Officials announced that schools in Kermanshah and Ilam provinces would be closed on Monday because of the temblor.

Provincial leaders in Kermanshah announced three days of mourning, Reuters reported. Iran's Supreme Leader Ayatollah Ali Khamenei offered his condolences on Monday morning and urged rescuers and all government agencies to do all they could to help those affected, according to state media.

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.

Meanwhile, neighboring countries have offered their condolences and support in the wake of the disaster. 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, Turkish Red Crescent's vice president, told the Associated Press from Habur border crossing that 33 aid trucks were en route to Iraq's 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' controversial September independence referendum.

Pakistan's government also extended its deepest condolences for the loss of life and injuries suffered by "our Iranian and Iraqi brethren."Foreign Minister Khawaja Muhammad Asif said Pakistanis' "thoughts and prayers are with the Iranian and Iraqi brothers who lost their lives in this tragic calamity and we pray for the speedy recovery of the injured."

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.

The Iraqi city of Halabja, closest to the epicenter, is notorious for the 1988 chemical attack in which Saddam Hussein's regime killed some 5,000 people with mustard gas -- the deadliest chemical weapons attack ever against civilians.

The Associated Press contributed to this story.