The explosion took place in the Kabal area of Swat, a district in Pakistanâs Khyber Pakhtunkhwa province.
A pro-police rally of local residents was taking place in the same area on Sunday, but it was not immediately clear whether the rally was the intended target.
The Tehreek-e-Taliban Pakistan militant Islamist group in a statement claimed responsibility for the attack.
At least 34 people were wounded in the explosion, according to a spokesperson for Rescue 1122.
The rescue official said the death toll rose to 17 from 14 after three victims died in hospital. The victims included seven police officers and 10 civilians. One of the dead persons was believed to be the suicide bomber, Fida Hussain, a regional police official, told Reuters.
Prime Minister Muhammad Shehbaz Sharif in a statement expressed âdeep grief and sorrow over the suicide blastâ.
The police said an operation had been launched to arrest anyone who may have assisted in the attack.
Militancy in Pakistanâs âborder areas has risen sharply in recent months, targeting mainly the âmilitary and police.
The Pakistani government blames the Afghan Taliban for the escalation, accusing it of providing support to the militants. The Taliban government has denied the accusations.
(Reporting by Mushtaq Ali in Peshawar and Saud Mehsud in Dera Ismail Khan; Editing by Rick Noack, Alex Richardson and Susan Fenton)