ISLAMABAD, Pakistan — Taliban militants killed at least nine soldiers and four paramilitary soldiers in an attack on a Pakistani Army base in northwestern Pakistan early Saturday, officials said. Ten civilians, including three women and three children who were living in a nearby compound, were also killed.

The brazen assault took place in the restive Khyber-Pakhtunkhwa Province just a day after a suicide bombing near a mosque in another northwestern town, Hangu, killed at least 26 people.

A spokesman for Tehrik-e-Taliban Pakistan, commonly known as the Pakistani Taliban, claimed responsibility and said the attack was to avenge the death of two Taliban commanders killed in American drone strikes.

According to initial details, Taliban militants, armed with heavy machine guns, fired rockets in the predawn assault at the base in Serai Norang in the Lakki Marwat district, setting off a heavy gun battle that lasted for several hours.