A suicide bomber has targeted a funeral procession in northwestern Pakistan, killing at least 29 people, including a legislator, and wounding more than 30 others, police have said.

The attack took place in the town of Sher Garh in Mardan district during funeral prayers for the owner of a local compressed natural gas (CNG) station, Abdullah Khan.

The blast, which police said appeared to target the politician, highlights the security challenges facing the new government of Prime Minister Nawaz Sharif, sworn in earlier this month after winning the May 11 general election.

The death toll was confirmed to Al Jazeera by Shaukat Yousafzai, the information minister of Khyber Pakhtunkhwa province (KPK).

Some of the wounded are in a serious condition and have been rushed to hospitals in Mardan and Peshawar. There were more than 100 people at the time of the funeral, according to sources. 

Attack took place in town of Sher Garh in Mardan district

A witness told Pakistan's Dunya television that 700 to 800 people were attending the funeral when the bomber detonated the device.

"We all fell down after the blast,'' he said. "There were bodies and wounded everywhere.''

Years of fighting

Imran Khan Mohmand, a lawmaker and provincial assembly member from Pakistan Tehreek-e-Insaf (PTI) party, was also believed to be killed.

Mohmand ran in Pakistan's May 11 parliament elections as an independent candidate and later supported PTI - the party of cricketer-turned-politician Imran Khan.

He is the second member of the assembly killed today. Earlier, Farid Khan of the same party was killed in Hangu district.

The carnage poses a challenge for the newly-installed provincial government of Imran Khan, who campaigned on a platform that he would negotiate with the Pakistani Taliban to bring an end to the years of fighting and attacks in northwestern Pakistan.

Khyber Pakhtunkhwa is on the frontline of a seven-year Taliban insurgency and borders the semi-autonomous tribal belt, where US drone strikes have targeted Taliban and al-Qaeda operatives.

Source: Al Jazeera and agencies