ISLAMABAD (AP) — Militants in Afghanistan fired heavy weapons across the border into a Pakistani military outpost overnight, killing three personnel, the army said Saturday, in the latest violence to rattle the volatile region.

A firefight ensued with the militants firing toward the army post in Pakistan’s rugged North Waziristan region, and several were killed, the statement said. There was no immediate way to independently confirm details of the attack.

It comes as Afghanistan is reeling from a series of explosions in recent days, including the bombing of a mosque in northern Kunduz province on Friday that killed 33 people, including several students of an adjacent religious school or madrassa.

Also read | Israel closes crossing to Gaza workers after Hamas rocket attacks

The striking increase in attacks in Afghanistan — as well as in neighboring Pakistan — highlights the growing security challenge facing Afghanistan’s Taliban rulers, who swept to power last August in the closing days of the chaotic withdrawal of American and NATO troops ending their 20-year war.

Even as their harsh religiously motivated edicts, which seemed reminiscent of their late 1990s rule, drew harsh criticism, their seemingly heavy-handed approach to security brought early expectations of improved safety.

However a vicious Islamic State affiliate known as the Islamic State in Khorasn Province, or IS-K — which claimed the recent spate of attacks in Afghanistan as well as a growing number in neighboring Pakistan — is proving an intractable challenge.

Also read | Russian forces made no major gains in Ukraine in the last 24 hours: UK

IS-K took responsibility for a series of attacks across Afghanistan on Thursday, most of which targeted the country’s minority Shiites who the radical Sunni Muslim group revile as heretics.

Still, the IS-K, which is an enemy of Afghanistan’s Taliban rulers, is not the only militant organization in Afghanistan contributing to the security dilemma facing Kabul’s religiously driven government.

The violent Pakistani Taliban, known as the Tehreek-e-Taliban Pakistan or (TTP) — which the United Nations says numbers around 10,000 in Afghanistan — has stepped up its assault on Pakistan’s military outposts from its Afghan hideouts. Even the upstart IS-K has taken responsibility for some of the attacks targeting Pakistani military personnel, damaging relations between the two countries.

Also read | French presidential election: Macron in pole position, Le Pen racing hard

Afghanistan’s Taliban rulers have promised no militant group would use its soil as a base to attack another country, but Kabul has yet to arrest or hand over any TTP leaders in Afghanistan to Pakistan. Other militant groups also operating in Afghanistan include China’s militant Uighurs of East Turkistan Movement, which seeks independence for northwest China, and the Islamic Movement of Uzbekistan (IMU).

Some of the groups are loosely allied to the IS-K , while others act more independently, but on Saturday Pakistan’s military statement warned Afghanistan’s Taliban rulers to do more.

“Pakistan strongly condemns the use of Afghan soil by terrorists for activities against Pakistan and expects that the Afghan Government will not allow conduct of such activities, in future,” said the Pakistan military statement.

Also read | Taiwan won’t impose Shanghai-like COVID lockdown: Premiere Su Tseng-chang

After seven of its troops were killed in an ambush earlier this month, Pakistan on April 16 retaliated with bombing raids inside Afghanistan that locals in Afghanistan’s eastern Khost province said killed dozens of refugees. The United Nations Education Fund (UNICEF) confirmed 20 children were killed in the strikes in Afghanistan’s border provinces of Khost and Kunar.

Meanwhile on Saturday the Abdul Rahim Shaheed School, which was among the IS-K targets in the Thursday attacks, re-opened. As many as seven students were killed in the attacks. The principal handed each student a pen and a flower as they began classes on Sunday.

Associated Press Writer Tameem Akhgar in Islamabad and Mohammad Shoaib Amin in Kabul, Afghanistan contributed to this report.