ISLAMABAD, Pakistan — At least nine people were killed and at least 30 others wounded on Sunday in Taliban attacks on a security checkpoint and a hospital in northwestern Pakistan, breaking a lull in militant violence in the country, officials said.

A spokesman for the Taliban said the attacks — by gunmen on motorbikes and a suicide bomber — had been carried out to avenge the killing of one of its militants last month in the district of Dera Ismail Khan. A senior police official said the suicide attacker had been female, but the Taliban later released a photograph of a longhaired man whom the group identified as the bomber.

The two-pronged attack on Sunday took place in the same district, Dera Ismail Khan, which is in the province of Khyber-Pakhtunkhwa. In the first attack, two police officers at a security checkpoint in the town of Kotla Saidan were shot dead.

The assailants escaped after the shooting, and the security forces cordoned off the area to search for them.

Shortly after the bodies of the two officers were taken to the hospital, an explosion ripped through the emergency and trauma center there, killing four other police officers and three civilians. The suicide bomber detonated about seven kilograms of explosives near an entrance to the hospital, according to a preliminary police investigation.

Salim Riaz Khan, the police chief of Dera Ismail Khan, said that initial inquiries suggested that the suicide attacker had been a woman, but another security official said that the bomber had been a young boy with long hair, a common look for most Taliban militants.

Only a few suicide bombings have been carried out by women in the long history of militant violence in the country.

The blast heavily damaged the entrance of the hospital, and the emergency department shut down afterward. Those injured in the second attack were shifted to a military hospital in the district.

On June 23, counterterrorism police officials killed a militant fighter during a raid at his compound in Dera Ismail Khan. He had been wanted by the police in more than a dozen cases of killings and kidnapping for ransom.

Militant violence has ravaged Pakistan for years, especially in the northwestern regions, where the Taliban have a strong presence, but the attacks have declined in recent years. Sporadic violence still takes place, however.