district of Khyber-Pakhtunkhwa province this afternoon when the bomber detonated his explosive vest near legislator Imran Khan Mohmand, police officials and witnesses said.
Mohmand was among the people killed in the attack, Shaukat Yousafzai, information minister of Khyber-Pakhtunkhwa, told reporters.
Other officials said a total of 28 people were killed and 57 others injured.
Doctors described the condition of 10 wounded as serious.
The blast occurred at the end of the 'namaz-e-janaza'. People ran helter-skelter in panic after the attack.
Several local dignitaries and politicians were attending the funeral of Haji Abdullah, the owner of a petrol pump who was gunned down by unidentified armed men last night.
The injured were taken to hospitals in Mardan and nearby cities. No group claimed responsibility for the attack.
Mohmand was elected to the provincial assembly as an independent candidate in the May 11 general election.
He later joined Imran Khan's Pakistan Tehrik-e-Insaf party, which heads the ruling coalition in the province.
He was the second legislator of the Tehrik-e-Insaf to be killed this month.
On June 3, legislator Farid Khan was shot dead by unidentified gunmen in Hangu district of Khyber-Pakhtunkhwa.
Information minister Yousafzai said police officials in Mardan had told him that Mohmand had been receiving threats for some time.
During the recent polls, his election office was attacked. Following this, Mohmand was provided two police guards.
Despite the killing of the legislator, Yousafzai said the Khyber-Pakhtunkhwa government was committed to holding talks with militants.
"There can be no solution without talks. All the stakeholders must be brought to the negotiating table so that we can hear their views," he said.
Operations by security forces alone cannot resolve the problem of militancy, Yousafzai claimed. The central government also has an important role in the matter as it sets policy, he said.
(With inputs from PTI and AFP)