peshawar school attack
A man carries a student who was injured during the attack in PeshawarKhuram Parvez/Reuters

The horrific attack on an army-run school in Peshawar that left at least 126 people dead, mostly children, has been claimed by Tehrik-i-Taliban Pakistan (TTP), the Pakistani Taliban, in revenge for the army offensive in north Waziristan.

"We selected the army's school for the attack because the government is targeting our families and females. We want them to feel the pain," said Muhammad Umar Khorasani, spokesman for the militant group.

The long-awaited military operation to wipe out the Islamist militant safe-haven from Pakistan's western border plays into a complex political relationship with its troubled neighbourhood Afghanistan.

Mistrust between the two countries stems from Afghan accusations that Pakistan is ultimately responsible for the violence in their country. A special focus is reserved for Pakistan's military and Inter-Services Intelligence agency (ISI), accused by the US and Afghanistan of nurturing, training, supporting and equipping Afghan Taliban fighters.

As the US force in Afghanistan is scheduled to drop to 5,500 by the end of 2015 and near zero by the end of 2016, questions over alleged Pakistani support for the Taliban insurgency remain unanswered.

"Pakistan's intelligence agency, the ISI, has been providing the Taliban with safe haven and sanctuary in Pakistan for over a decade," Bruce Riedel of the Brookings Intelligence project wrote yesterday.

"The ISI participates directly in planning Taliban operations and target selection against Nato and Afghan targets. It helps arm and fund the Taliban and assists its fundraising efforts in the Gulf states."

Pakistan denies the charges, reversing the allegations by claiming Afghanistan provides safe havens for terrorists. In July, as the ground operation on Islamist groups was launched, a senior general complained about the presence in eastern Afghanistan of Mullah Fazlullah, the leader of TTP.

"Whenever he comes to Pakistan then we can get him and he will be eliminated," said Major General Asim Bajwa, Pakistani army's spokesman. "But before that we are expecting our Afghan brethren, who we have requested to do their bit, to either eliminate him or hand him over to Pakistan."

Supporting Haqqani

However, it has been widely acknowledged that the ISI failed to contain the infamous Haqqani network, which carried out deadly attacks on US troops in Afghanistan.

Afghan officials claimed that Haqqani fighters were allowed to escape to Afghanistan before the operation was launched on 15 June. "The Haqqani network keeps an office in Rawalpindi near the ISI headquarters. General Sharif supervises all of this, just as his predecessors did before him. The general, not the prime minister, makes Afghan policy," Riedel wrote.

Tensions have increased in the past year as more than 2,000 Afghan police officers and soldiers have been killed. Afghan officials have accused Pakistan of sending army commandos, doctors and military advisers to train Afghan Taliban.

They alleged that the military operation to dislodge Pakistani Taliban from Waziristan had the effect of pushing Islamists into Afghanistan.

General Zahir Azimi, an Afghan army spokesman, said: "They were thinking: 'Foreigners are leaving Afghanistan. They don't have a strong air force . . . so we will ramp up our attacks and overrun provinces."

He added that Afghan intelligence intercepted phone conversations between militants and suspected ISI agents.

A new hope

Afghan officials also accuse Pakistan of having fired nearly 5,000 rockets into eastern Afghanistan since last spring, in an attempt to clear the ground for Islamist militants and allow them to establish bases in Afghanistan.

Most recently, the appointment of an all-clean general at the head of Pakistan's spy agency spurred hope for the corrupted intelligence force. General Rizwan Akhtar commanded the paramilitary Rangers during the country's crackdown on the criminal mafias with excellent results. His charisma and high moral standards may help reforming the ISI from the terrorist-backing image they gained over the years.

"For him a terrorist is a terrorist," Nasir Aftab, a senior Karachi policeman, told the Guardian. "There is no impression of good terrorism or bad terrorism, or that some are working for Pakistan."

Experts believe that the surge of domestic terrorism has pushed Pakistan's military to change its murky approach to the Taliban, thus explaining the military operation in north Waziristan.

Now, jihadists are taking revenge and turning the guns against their former founder and supporter.