At least eight people, including two police officers and two children, were killed in a suicide attack Monday in Pakistan's northwestern Khyber Pakhtunkhwa province, district police officer Sohail Khalid told CNN.
Another 21 were injured in the incident, which took place in the Charsadda District.
A spokesman for the Pakistani Taliban claimed responsibility for the attack, saying it was in retaliation for the execution of Mumtaz Qadri on March 1.
Qadri was convicted of killing the governor of Punjab province in 2011.
The incident began at about noon local time, when the attacker opened fire outside the gates of the Charsadda court. When security officers tried to stop him from getting inside, the gunman detonated explosives that were strapped on his body.
Prime Minister Nawaz Sharif issued a statement condemning the attack.
"The nation is united in its commitment to wipe out this menace from our soil," the statement read. "Those who embraced martyrdom in the line of duty sacrificed their today to safeguard a peaceful tomorrow for our future generations, and they deserve gratitude and recognition of the highest degree."