PESHAWAR, Pakistan — A suicide bomber attacked the funeral for a slain police officer in Pakistan's volatile Swat Valley, killing at least 35 people and wounding 62 others, police said.

The attack occurred at a government high school in Mingora town while funeral prayers were being held for Javed Iqbal, who was killed in a roadside bombing earlier in the day.

About 800 people were at the funeral, including civilians and police officials, said Shahbuddin, an assistant inspector of police who was at the funeral on security duty and who uses one name.

The explosion occurred just as the pallbearers lifted the coffin to carry it toward the grave, he told The Associated Press.

"As the coffin was lifted I moved toward the gate but suddenly a big explosion took place, which dashed me against the gate ... It was hell. Everybody was crying for help," said Shahbuddin, who was slightly injured in the attack.

Mingora, in Swat Valley in northwestern Pakistan, is 105 miles from Peshawar, a town at the border with Afghanistan.

President Pervez Musharraf sent thousands of troops to the scenic Swat Valley earlier this year to quell an uprising led by a pro-Taliban cleric. The army claims it has dispersed thousands of his militant followers, but attacks persist. Last week, a roadside bomb hit a wedding party, killing 12 people.

Iqbal, the deputy police chief of the Lakki Marwat district, and his driver were killed in a roadside bomb Friday morning. By the time his body was brought to his hometown of Mingora for the funeral, night had fallen.

"Because it was dark, the suicide bomber was able to mingle among the people easily," Shahbuddin said.

He said he later went to the hospital where the injured were taken.

"I have seen 35 dead and over 60 injured in the hospital and am now completing the paperwork," said Shahbuddin.

Dr. Fazal Wahab, who was treating the injured, said the hospital has been overwhelmed by the high casualties.

"We have treated a large number of injured, some in very critical condition," he told the AP.

Taliban militants have stepped up attacks and taken control of tracts of northwestern Pakistan bordering Afghanistan in the past several years. Before militants took root last summer, Swat attracted tourists because of its fine mountain scenery.