ITTEFAQ, Afghanistan — For several minutes after the earthquake struck, he could hear their screams. Then there was silence.

Mohibullah Niazi, a neighbor who helped in the rescue efforts, said Saturday that the eight people killed on the outskirts of Kabul in an earthquake the night before were an Afghan refugee family recently returned from neighboring Iran. A wall collapsed onto the tent in which they were living in the village of Ittefaq.

There was only one survivor: a boy of about 3, who was injured and has been hospitalized in Kabul.

The death toll from the magnitude 5.8 earthquake in northern Afghanistan on Friday night rose to 12, with four injured, Afghan deputy government spokesman Hamdullah Fitrat said Saturday. He said five homes were destroyed and 33 significantly damaged, affecting 40 families in the provinces of Kabul, Panjshir, Logar, Nangarhar, Laghman and Nuristan.

The Afghanistan Disaster Management Authority put the overall death toll at nine. The reason for the discrepancy was not immediately clear.

The family near Kabul was among the millions of Afghan refugees who have recently returned from Iran and Pakistan, after both countries launched crackdowns in 2023 on foreigners — particularly Afghans — living in their countries.

They had arrived 15 days ago and were living in a tent on land next to Niazi’s home. The family head, Najibullah, who was about 50 years old, “had no other shelter,” Niazi said. “He was a very poor person.”

The family had set their tent up next to a wall separating the plot of land from Niazi’s home, which stood on higher ground, in the village of Ittefaq on the eastern outskirts of the Afghan capital.

Heavy rains over the last several days, which have led to deadly floods in many parts of Afghanistan, had left the ground sodden and soft. When the earthquake struck, the wall collapsed on the family.

“My daughter shouted to me that a wall had fallen on them. The whole family ran, but there were so many big rocks,” Niazi recounted Saturday as he stood at the scene. “We tried our best.”

On Saturday morning, piles of bricks and mud were all that were left, along with blankets, cooking utensils and other personal belongings salvaged from the rubble and set into a pile.

“For about three minutes, I could hear the voices of these people,” Niazi said. “But we couldn’t do anything. There were two or three of us, but this was not the work of three people.”

Neighbors soon rushed to help, digging through the mud and rubble with spades and hands. They alerted the local Taliban police checkpoint, which sent rescuers and ambulances.

The young boy, Aarash, was pulled out alive but injured, and rushed to the hospital. Health Ministry spokesperson Sharafat Zaman, who visited the boy Saturday, said he was being treated for a severe head injury.

For the rest of the family — the father and mother, four daughters aged between 12 and 23, and two sons — it was too late. The rescuers could only recover their bodies.

Niazi said he had hosted the family in his home one night. On Friday, just half an hour before the earthquake struck, he had renewed the offer, telling the family they could spend the night in his guest room to shelter from the cold and rain. “But they did not come with me,” he said.

Friday night’s quake had an epicenter in the Hindu Kush mountain range, about 90 miles east of the northern city of Kunduz, according to the Euro-Mediterranean Seismological Center and the U.S. Geological Survey. The area is about 180 miles northeast of Kabul.

Afghanistan lies in a highly seismically active part of the world, and quakes have caused thousands of deaths in recent years.

In August, a magnitude 6 earthquake struck a remote, mountainous part of eastern Afghanistan, killing more than 2,200 people. Most casualties were in Kunar province, where people typically live in wood and mud-brick houses along steep valleys.

In November, a magnitude 6.3 quake struck Samangan province in northern Afghanistan, killing at last 27 people and injuring more than 950. It also damaged historical sites, including Afghanistan’s famed Blue Mosque in the city of Mazar-e-Sharif, and the Bagh-e-Jahan Nama Palace in Khulm.

On Oct. 7, 2023, a magnitude 6.3 quake followed by strong aftershocks in western Afghanistan killed thousands of people.

Becatoros writes for the Associated Press. AP writer Abdul Qahar Afghan contributed to this report.