KABUL/ISLAMABAD (Reuters) - The Taliban encouraged aid groups to help victims of the massive earthquake in northern Afghanistan and Pakistan as rescuers struggled to form a clear picture of the damage caused by the disaster as the death toll passed 300.

A resident walks past a shop damaged by an earthquake in Chitral, Pakistan, October 27, 2015. REUTERS/Stringer

With large mountainous areas of Afghanistan hit and icy weather closing in, the unstable security situation has posed a major challenge to international aid groups that have been repeatedly targeted by insurgents.

But the Taliban, which have driven their Islamist campaign against the Western-backed government in Kabul across the country this year, indicated they would not stand in the way of aid efforts and ordered fighters to help victims.

“The Islamic Emirate calls on our good-willed countrymen and charitable organizations to not hold back in providing shelter, food and medical supplies to the victims,” the group said in a message of condolence to quake victims, using its formal name.

“And it similarly orders its mujahideen in the affected areas to lend their complete help.”

Authorities confirmed 228 deaths in Pakistan while in Afghanistan, the death toll reached at least 115, Sayed Zafar Hashemi, President Ashraf Ghani’s deputy spokesman, said. At least 4,000 houses and compounds had been destroyed or damaged, Afghan Chief Executive Abdullah Abdullah said.

The toll could climb as road and communications links are restored to isolated villages and as winter sets in across the rugged Hindu Kush mountains where the earthquake struck, the plight of thousands left homeless is becoming more serious.

“We have insufficient food and other aid,” said Abdul Habib Sayed Khil, chief of police in Kunar, one of the worst-hit provinces, where 42 people were confirmed dead. “It has been raining for four days and the weather is very cold.”

The worst impact was reported in Faizabad, capital of Badakhshan province but there was also significant damage in the provinces of Kunar, Nuristan, Laghman, Takhar, Baghlan and Nangarhar.

In Kabul, the capital, NATO officials said they were helping Afghan security forces plan relief operations but aid groups were still assessing how to reach the areas and how to operate once they were there given the danger to their teams.

“Security is of course a large factor,” said Kjersti Haraldseide, acting Country Director for the Norwegian Refugee Council. “There is a limitation to humanitarian actors’ access to some of the areas,” she said.

In Pakistan, where landslides and heavy rain and snow over the weekend had already left thousands of tourists stranded in mountainous areas of the north, the well-equipped military was heavily involved in relief efforts.

By Tuesday evening, troops had managed to clear and reopen the region’s main road, the Karakoram highway linking Pakistan to China, after it was blocked by landslides. Two army helicopters joined the relief mission.

The earthquake struck almost exactly six months after Nepal suffered its worst quake on record, on April 25. Including the toll from a major aftershock in May, 9,000 people lost their lives there and 900,000 homes were damaged or destroyed.

Monday’s initial quake of magnitude 7.5 was followed by seven aftershocks, of intensity ranging as high as 4.8, the U.S. Geological Survey said. The latest aftershock came just before dawn on Tuesday.

The quake was 213 km (132 miles) deep and centered 254 km (158 miles) northeast of Kabul.

The United States and Iran were among countries that offered humanitarian assistance to Afghanistan, which already depends heavily on foreign aid after decades of war wrecked its economy and infrastructure.

Pakistani Prime Minister Nawaz Sharif said a relief package would be announced after damage had been assessed.