PESHAWAR, Pakistan (Reuters) - Taliban gunmen killed 29 people, including 16 praying in a mosque, when they stormed a Pakistani air force base on Friday, a military spokesman said, in the deadliest Taliban attack on a military installation in the country’s history.

The 13 gunmen were also killed in the attack on Badaber air base, close to the northwestern city of Peshawar.

The assault shows the Taliban retain the capability to mount devastating attacks despite a military campaign and a government crackdown against them following the massacre of more than 150 people, mostly children, at an army-run school last December.

Twenty-two of those killed in the attack were serving in the Pakistan air force, four were civilians and three were army soldiers responding to the attack, Major General Asim Bajwa told a news conference. Twenty-nine people were wounded, he said.

“The terrorist group used two gates. They came close to the gate and disembarked from their cars and then they used rocket launchers and grenades and fired as they entered the gate,” said Bajwa, who said the attack has been masterminded in Afghanistan.

A reaction force arrived within 10 minutes and the attackers were contained close to the areas where they entered, he said. But they were still able to enter the mosque and killed 16 of those inside, he said.

Mohammad Ikram of the Pakistani Air Force, who offering his morning prayers at the time the attack began, said most of those inside the mosque were hit by gunfire in the attack claimed by the Taliban.

“We were offering prayers when we first heard the gunshots and then, within no time, they entered the mosque where they began indiscriminately firing,” he said by telephone from a hospital bed where he was being treated for gunshot wounds.

“They killed and injured most of the worshippers. I fell on the ground. Then the gunmen went to other places in the base. After a long time, we were shifted to the hospital.”

Emergency workers wheel an injured man to a hospital after an attack on an air force base in Peshawar, Pakistan, September 18, 2015. REUTERS/Khuram Parvez

AFGHAN LINKS?

The attack may worsen already chilly relations between Afghanistan and Pakistan, after Bajwa said communication intercepts showed the attackers were receiving directions from Afghanistan, where many Pakistani Taliban have bases.

“This operation was planned in Afghanistan, and was executed from there. And it was being controlled from Afghanistan,” he said. “No one can say that the Afghan state has encouraged this, but the fact is that it was launched from Afghanistan.”

Afghanistan and Pakistan have separate but allied Taliban insurgencies. The two nations frequently accuse each other of not doing enough to stamp out insurgent havens on either side of their porous border.

Bajwa released pictures of some of the attackers’ bloodied bodies in the uniform of the paramilitary Frontier Constabulary, black traditional Pakistani clothes.

The Taliban released a video about the attack featuring Umar Mansoor, the same commander who claimed responsibility for the Peshawar school massacre.

“We proudly claim responsibility for the attack on Pakistani air base,” Taliban spokesman Muhammad Khorasani told Reuters. “This base is being used by fighter jets for bombing us.”

Attacks by the Taliban have fallen about 70 percent this year, following a military offensive against the militants’ bases along the Afghan border that began in June 2014 and the government’s redoubled efforts to combat them after the Peshawar school attack.

Despite the reduction in attacks, the militants still manage to strike high-value targets. The home minister of Punjab province was among 16 killed in a suicide attack last month.

In a separate incident in northwest Pakistan, eight civilians were killed in a military strike in South Waziristan early on Friday, a survivor told Reuters.

“The house next to my house was completely destroyed,” said

Naimat Ullah, whose son was injured by flying shrapnel.

Neighbours who excavated the bodies had told him three young girls, three men and two women died in the strike, he added. The civilian deaths were confirmed by a relative of Abdul Manan Khan, the man whose house was destroyed.