Pakistani militants say a suicide bombing at a court in which at least 10 people were killed was revenge for the hanging of a man convicted of the 2011 killing of a prominent liberal politician who had called for reform of blasphemy laws.
Police said the bomber had intended to enter the court in the northwestern town of Shabqadar, near the Mohmand ethnic Pashtun region, and set off his explosives when guards challenged him.
"The suicide bomber was trying to enter the judicial complex and he blew himself up when the police stopped him," said police official Saeed Wazir on Monday (local time).
Television news footage showed extensive damage including the charred remains of at least two vehicles.
Senior police official Sohail Khalid told Reuters two police personnel, as well as four women and two children were among at least 10 people killed. Nearly 30 people were wounded.
The Pakistani Taliban's Jamaat-ur-Ahrar faction claimed responsibility for the attack in the town, about 150km northwest of the capital, Islamabad.
Group spokesman Ehsanullah Ehsan said in an emailed statement the bombing "was especially done as vengeance for the hanging of Mumtaz Qadri".
Qadri, a bodyguard-turned-assassin, was executed last week for killing Salman Taseer, the then governor of Punjab province, after he had called for reform of blasphemy laws that mandate death for insulting Islam or its prophet.
Human rights groups say the laws can be abused by people trying to settle scores or involved in feuds, and members of Pakistan's religious minorities are vulnerable to unfair treatment under the legislation.
The laws are at the heart of an ideological clash between reformers and religious conservatives in Pakistan.
Hard-line religious leaders have declared Qadri a hero and Ehsan said his faction would continue to attack courts.
"The Pakistani courts give decisions against the laws revealed by Allah, and convict and hang innocent people," Ehsan said in his statement.
Pakistani Taliban militants have been waging an insurgency against the state since 2007, in a bid to impose a strict interpretation of Islamic law.
A series of military operations in the Pashtun lands along the Afghan border -- the latest of which was launched in 2014 -- have reduced the militants' ability to hit major targets regularly, but attacks have continued.