Afghanistan's defence ministry said on Sunday its forces had killed 28 fighters and wounded 32 in the eastern province of Nuristan after a group it said included IS rebels crossed from Pakistan.
The ministry alleged Pakistani rebels had supported the fighters and that most of them were former Afghan government security personnel.
Pakistan's military and information ministry did not immediately respond to a request for comment. Reuters could not independently verify the ministry's account or its casualty figures.
Kabul's claim that Pakistani intelligence trained and sent former Afghan security personnel across the border is a direct allegation of state involvement in an armed incursion. It comes less than a week after Pakistan launched airstrikes inside Afghanistan, saying it had targeted fighters.
Pakistan has repeatedly accused Afghanistan of sheltering fighters who attack its territory, a charge Kabul denies.
The ministry said the group crossed into Kamdesh, a district of Nuristan near the Pakistani border, on Saturday with the intention of carrying out attacks. Afghan forces launched an operation, and the surviving fighters fled back across the border towards Pakistani militia positions, it said.
It alleged that Pakistani armed personnel and rebel members had coordinated with the fighters but withdrew when fighting began. The ministry also accused Pakistani intelligence of taking former Afghan security personnel to Pakistan under the pretext of assisting them, training them and sending them towards Nuristan.
The incident follows Pakistani airstrikes in Afghanistan on September 21 that Islamabad said killed 28 fighters. Afghan officials said civilians were killed, and the UN mission in Afghanistan confirmed three civilian deaths.

Floods, landslides kill 56 in India and 14 in Nepal
South African police hunt suspects after 27 killed in two separate shootings
Trump rejects Iranian proposal to open Hormuz and end fighting
Kazakhstan's Tokayev dismisses defence minister after 14 die during naval exercise
Bangkok floodwaters recede as officials race to drain canals