KABUL, Afghanistan — A suicide bomber walked into a cemetery in eastern Afghanistan on Sunday and blew himself up during the funeral of a local official, killing at least 17 people and wounding 14 others, an official said.

The attacker set off an explosive vest among mourners gathered for the funeral of Gul Wali, the former district chief of Haskah Menah, according to Attaullah Khogyani, a spokesman for the governor of Nangarhar Province.

The attack unfolded as a man on foot set upon Maqam Khan cemetery in the Bihsud District, near the provincial capital, Jalalabad. Mr. Khogyani said he expected the death toll to rise.

No one immediately claimed responsibility for the assault. But the Taliban and an Islamic State affiliate are both active in Nangarhar and routinely target local officials.