A 7.5-magnitude earthquake wreaked destruction in Afghanistan, Pakistan and India on Oct. 26. Onlookers took to social media to share scenes of the earthquake and its aftermath as the death toll rises. (Victoria M. Walker/The Washington Post)

A massive earthquake leveled remote villages in Afghanistan and Pakistan on Monday, killing hundreds of people as stone and mud houses crumbled in the shaking or were buried by landslides and avalanches.

The death toll — now at more than 300 — was expected to rise, perhaps significantly, as officials in both countries struggled to contact the regions most affected by the powerful quake, which had a preliminary magnitude of 7.5.

The worst damage was feared to be in a part of Afghanistan where some areas are effectively controlled by Islamist militant groups, including the Islamic State. Aid workers were trying to reach the quake’s epicenter in Jurm, a little-populated, mountainous swath of land in northeastern Afghanistan where the Taliban is present.

Afghan disaster-management officials placed the death toll in their country at 74, with more than 260 injured and as many as 4,000 houses severely damaged. Among the victims were 12 students at a girls’ school in northern Afghanistan who died in a frantic dash from shaking buildings.

Across the border in Pakistan, at least 237 people were killed in the earthquake. But the damage knocked out cellphone service, raising concerns that the death toll will rise dramatically once rescue teams reach rural areas.

“The situation doesn’t seem good, and we pray to God that loss is not higher,” said Pervez Khattak, the chief information minister for Pakistan’s northwestern Khyber Pakhtunkhwa province, where at least 132 people were killed.

According to local officials, the hardest-hit villages in Pakistan were in the Swat Valley, Upper Dir and Chitral, a summer playground for rich Pakistanis who flock to the area to watch yak polo on mountain plateaus.

Syed Zahid Jan, a journalist from the Upper Dir district, said entire villages appear to have been destroyed in the region, which borders Afghanistan.

“We survived, but two houses . . . near our house collapsed,” Jan said. “Many houses are totally or partially damaged.”

In Pakistan’s major cities, however, the damage was sporadic. Some buildings reportedly collapsed in Peshawar, the capital of Khyber Pakhtunkhwa province, but there did not appear to be widespread devastation. In Islamabad, frightened office workers rushed out in the streets when the earthquake struck about 2 p.m., but there were no reports of major damage.

“First it was a terrible shock, and then in a minute all shopkeepers and others were out of shops in the street,” said Zafar Ahmed, a waiter at an upscale food market in Islamabad. “Children screamed, as well, perhaps terrified by rush and fear. I felt as if all of these buildings would collapse, but thank God that didn’t happen.”

Farther north, there were widespread concerns that some areas of Pakistan’s Gilgit-Baltistan region wouldn’t be so lucky. The earthquake triggered numerous landslides and avalanches in that region, officials said. Pakistan’s army reported that the Karakorum Highway, which connects the capital, Islamabad, to the Chinese border, was blocked in at least five places.

Officials were even investigating reports that part of a glacier near Mount Nanga Parbat, the world’s ninth-tallest mountain, had collapsed.

Near the Afghan city Mazar-e Sharif, the shaking was strong enough to knock some items off the walls at the German-run military base Camp Marmal. Most American and Afghan contractors working in the airport’s control tower briefly fled to the ground as it began to sway, said Carey James, an air-traffic controller and contractor there from IAP Worldwide Services of Panama City, Fla.

Bagram air base, the massive coalition military airfield about 30 miles north of Kabul, also experienced significant shaking, said Capt. Bryan Bouchard, an Air Force spokesman stationed there. The base, which is home to a fighter wing with F-16 jets and other aircraft, shook for what felt like a minute or two, he said.

“Initially following the earthquake, we sent out a team to evaluate the airfield, and there were no adverse impacts to it or our flying operations,” Bouchard said.

Afghanistan has long been prone to earthquakes. The last major one struck in March 2002 in Baghlan province in the north, where more than 1,500 people died. In remote mountainous areas, such as Badakhshan, most Afghans live in mud houses that easily crumble during large quakes. Landslides are also quite common, and in recent weeks there has been much rainfall in the region, exacerbating the impact of an earthquake.

The U.S. Geological Survey said seven other quakes of magnitude 7 or greater have occurred in the past century within 150 miles of Monday’s epicenter. The most recent was also in March 2002, just 12 miles west of the latest quake zone. More than 150 people died in the 2002 quake.

One factor that could limit the damage was the relative depth of Tuesday’s quake — estimated at about 125 miles below the surface — which may lessen ground shaking, the U.S. Geological Survey said.

In northern India, tremors were felt throughout the region — most severely in the state of Jammu and Kashmir, where widespread power and telephone outages were reported. Metro service in New Delhi was temporarily suspended as a precaution in the quake’s aftermath.

“I pray for everyone’s safety,” Indian Prime Minister Narendra Modi wrote in a Twitter message.

In a statement, Pakistan’s army chief, Gen. Raheel Sharif, said he had ordered the country’s armed forces to start carrying out rescue operations “without caring or waiting for orders.”

Craig reported from Islamabad. Haq Nawaz Khan in Peshawar, Pakistan, Sayed Salahuddin and Mohammad Sharif in Kabul, Dan Lamothe at Bagram air base in Afghanistan, Annie Gowen in New Delhi, and Brian Murphy in Washington contributed to this report.

Read more:

Today’s coverage from Post correspondents around the world