ISLAMABAD, Pakistan — At least 14 people were killed and 28 injured in an attack on a Shiite religious school in northwestern Pakistan on Friday, police officials said, while Taliban militants claimed responsibility for killing a provincial lawmaker and his son in the southern port city of Karachi.

In the northwest, three attackers, including a suicide bomber, tried to storm the school in Peshawar, the provincial capital of restive Khyber Pakhtunkhwa province, just before Friday prayers. A police guard tried to stop them in a brief exchange of gunfire and wounded the suicide bomber, said Liaqut Hussain, the Peshawar police chief. The injured bomber, however, managed to get inside the compound and detonate his explosives.

Television images showed rescue workers ferrying the wounded to nearby hospitals. The explosion left a trail of destruction and pools of blood. The bomber’s two accomplices managed to escape, according to police officials.

Extremist Sunni militants have repeatedly targeted Shiites in the country, causing a deep sense of insecurity among the Shiites. Most of the violence against Shiites has been concentrated in the southwestern city of Quetta, where Shiites belonging to the Hazara ethnic community have repeatedly come under attack.