The Pakistani Taliban on Sunday claimed responsibility for a suicide attack the day before that killed 11 soldiers and wounded 13 in the Swat Valley.
Authorities say Saturday's attack was the first in over three years in the northwestern region once ruled by militants.
In a statement sent to media, the extremist group said a lone suicide bomber carried out the attack to avenge the killing and arrests of fellow militants. The bomber detonated his explosives vest near an empty lot where soldiers were playing volleyball.
Islamic militants ruled the picturesque Swat Valley from 2007 until a massive military operation routed them in 2009. Pakistan says militants who escaped from Swat and elsewhere are now operating out of the Kunar province in neighbouring Afghanistan.
An Afghan official says Pakistani forces shelled Kunar for several hours starting late Saturday, wounding at least four civilians. Faredullah Dehqan, spokesman for the provincial police chief in Kunar, said more than 180 artillery rounds were fired overnight.
There was no immediate comment from Pakistan, and it was not clear if the shelling was linked to Saturday's attack.
Afghanistan and Pakistan frequently accuse each other of failing to crack down on extremists that operate along their porous border. On Friday, Afghan President Ashraf Ghani said Pakistan was partly to blame for a wave of recent attacks in Kabul, and that Islamabad was harbouring the Afghan Taliban.