PESHAWAR, Pakistan — Taliban militants shot and killed at least 30 people, including 16 people in a mosque, at an air force base near this city in northwestern Pakistan on Friday, military officials said, in the first major assault on a Pakistani military installation this year.

At least 13 attackers dressed in paramilitary uniforms were killed in an intense firefight at the base, which began at dawn and lasted for at least four and a half hours, said Maj. Gen. Asim Bajwa, a spokesman for the Pakistani Army. Among the dead were 23 members of the Pakistan Air Force, three members of the army, and at least four civilians, the military said.

The Pakistani Taliban took responsibility for the attack at the sprawling Badaber Air Base, saying that 14 militants had taken part. A video released by the group showed a Taliban commander, Omar Mansoor, saying goodbye to fighters said to be the ones who stormed the base.

That commander is believed to have been involved in the massacre of more than 140 people, most of them children, at an army school in Peshawar in December. The attack on Friday was the first major Taliban assault on a Pakistani military base since then.