A suicide bomber has blown himself up outside a government office in a north-western Pakistani city, killing at least 26 people and wounding 45 in an attack claimed by a breakaway Taliban group.
The bombing took place in the city of Mardan, outside the regional office of the National Database and Registration Authority, or NADRA, which issues identity cards, according to senior police officer Saeed Khan Wazir.
Mr Wazir said some of the wounded were in critical condition at a hospital in the nearby city of Peshawar.
"A gunman opened fire and killed a guard upon being asked to stop for checking. Then he exploded his suicide jacket," he said.
If the attacker had managed to enter the government office he might have killed many more people, Mr Wazir said.
Mohammad Qasim, speaking from his hospital bed, said he went to the office to receive his national identity card, which is issued at the age of 18.
"I was in a very happy mood today. I told my family and friends that I would receive my national identity card, but I didn't know that I would become the target of a bombing," said Mr Qasim, who had bandages on both legs.
Shortly after the attack, a spokesman for the militant Jamaat-ul-Ahrar group claimed responsibility for the bombing, calling it a "noble act to punish NADRA because it extends support to security forces".
Jamaat-ul-Ahrar split from the Pakistani Taliban two years ago.
Prime minister Nawaz Sharif condemned the bombing and instructed authorities to provide the best possible treatment for the wounded.
Mardan is about 50 kilometres (30 miles) north west of Peshawar, the capital of Khyber Pakhtunkhwa province, which borders Afghanistan and the North Waziristan tribal region.
Pakistani forces have been carrying out a major operation against the Taliban and other militants in North Waziristan since 2014. Earlier this month, the military claimed "phenomenal successes" in the war and said it has killed around 3,500 insurgents since launching the operation.
But attacks have been rampant in Khyber Pakhtunkhwa, and in December 2014, militants killed 148 people, mainly children, in an attack on an army-run school in Peshawar. The Taliban later claimed responsibility for the school attack.
Pakistan executed four convicted militants for involvement in acts of terrorism on Tuesday, according to two officials. Since the school attack, Pakistan has executed 330 people, most of them convicted criminals, not militants.