A suspected suicide attack at a government office in north-west Pakistan has killed at least 22 people, police say.
The bomb went off outside the National Database and Registration Authority (Nadra) office in the town of Mardan.
A faction of the Pakistani Taliban said it carried out the attack, which left more than 30 others wounded.
The attack is one of the deadliest since last December's massacre of 150 pupils and teachers in Peshawar.
The bomber in Mardan reportedly arrived on a motorbike and blew himself up when stopped by a security guard outside the Nadra building.
The office is usually crowded with people lining up to get ID cards.
Police put the death toll at 22 so far. Most of the dead and wounded are civilians.
The Bacha Khan Medical complex has received at least 16 dead bodies and dozens of injured people, Reuters news agency reports.
If the attacker had not been stopped by a security guard at the office's gate, the death toll would be significantly higher, Mardan police Deputy Inspector General Saeed Wazir told BBC Urdu's Adil Shahzeb.
He said up to 12kg of explosive material may have been used in the blast.
Jamaat-e-Ahrar, which split from the Pakistani Taliban in 2014, said it carried out the attack on what it called the "heathen Pakistan state".
The group, along with others, also claimed responsibility for an explosion that killed more than 50 people at the Wagah border crossing with India in 2014.
Mohammad Khurasani, spokesman for Tehrik-e Taliban Pakistan (TTP), the main faction in the country, said the group did not support attacks on public places.
It has, however, previously claimed responsibility for many attacks on civilians, including the Peshawar school massacre in December 2014.
Tuesday's bombing is one of the deadliest since a security crackdown following that attack, which saw 150 people killed by the Pakistani Taliban.
Offensives against insurgents have reduced major militant attacks from dozens every month in 2014 to no more than one or two a month this year.
Deadly attacks in Pakistan this year:
30 January: Bomb blast at a Shia Mosque in Shikarpur district, Sindh province, kills at least 40 people.
13 February: Militants attack a Shia mosque in Peshawar with guns and grenades. At least 20 people killed.
15 March: Two explosions targeting worshippers attending Sunday Mass at churches in Lahore kill at least 14.
13 May: Gun attack on a bus carrying Ismaili Shia Muslims in Karachi leaves at least 45 people dead.
18 September: Taliban militants kill 29 people in an attack on an air force base in Peshawar.
13 December: Bomb blast kills 24 people at a clothes market in the Kurram tribal region.