A group of Taliban militants attacked an air force base in northwestern Pakistan early Friday, killing at least 29 people and wounding many others.

Authorities say heavily armed militants in paramilitary forces uniforms staged the attack on Badhaber base near the city of Peshawar.

Military spokesman Major-General Asim Bajaw told reporters that militants wearing paramilitary forces’ uniforms and entered the residential compound of the Badhaber base near Peshawar in two groups.

One of the groups stormed a mosque where base staff were offering early morning prayers, he said, adding that the attack left 16 worshipers dead. The other group of militants attacked another area of the compound, killing several other people.

Bajwa said a quick reaction force reached the base and engaged the attackers, killing 13 of the militants. He said an army officer and five security personnel were killed in the gunbattle, while 30 others, mostly soldiers, were wounded.

General Bajwa alleged that the terrorist attack was planned in Afghanistan and those involved in it came from across the border.

After the hourslong siege, Pakistan military chief General Raheel Sharif visited the base and met with security forces who took part in the counterterror operation.

General Bajwa alleged that the terrorist attack was planned in Afghanistan and those involved in it came from across the border.

The outlawed Pakistani Taliban claimed responsibility for the violence.

It said the attack was meant to avenge counterterrorism operations Pakistan’s military has undertaken against the group’s strongholds and fighters.

A spokesman for the militant outfit later emailed a video to VOA, showing 16 men being seen off by their supervisor, saying they are the suicide bombers who took part in the assault on the air base.

The Pakistani Taliban has been waging a bloody insurgency to impose its extreme brand of Islamic fundamentalism on the country and to avenge military attacks against its bases in northwestern tribal areas bordering Afghanistan.

Tens of thousands of Pakistanis have died in the decade-long insurgency.

However, authorities report a 70 percent decline in the violence, attributing it to the ongoing army offensive called Zarbe Azb launched in June 2014 in tribal areas and urban parts of Pakistan.