Hamid Gul, the former head of Pakistan’s Inter-Services Intelligence spy agency, who passed away on August 15, was the epitome of a Pakistan army officer who became an advocate and supporter of the global jihad. His legacy is an army that remains both a patron and a victim of terror. South Asia and the world are more dangerous thanks to his years of duplicity and violence.

Gul died at the age of 78 in Murree. He joined the Pakistan army in 1956 and fought in the 1965 and 1971 wars with India as a tank commander. He became a protege of General Zia-ul-Haq and succeeded his patron as commander of the powerful First Armoured Division in 1980 after Zia had seized power in a coup.

Zia gave Gul command of the ISI in March 1987, replacing General Akhtar Abdur Rahman. Akhtar had devised the strategy of supporting the mujahideen in Afghanistan that bogged the Soviet Union’s 40th Red Army down in a quagmire. Zia and Akhtar trained, equipped and led the Afghans while securing the support of the United States and Saudi Arabia to fund the war. China provided the bulk of the weapons. It was a careful strategy, devised to keep the pot simmering in Afghanistan, not to let it boil over and provoke a Soviet attack on Pakistan. By 1987, the Russians were losing in Afghanistan and preparing to withdraw in defeat. Zia and Akhtar died in a mysterious airplane crash just as victory seemed close.

Gul pushed a new strategy once the Russians left in early 1989. The mujahideen would transition from guerrilla warfare to conventional warfare. They would take on the Afghan communist army the Soviets had left behind in Kabul and other cities for a decisive final offensive. Gul told Pakistan’s young prime minister, Benazir Bhutto, that the war would be over in a few months and Pakistan would instal a puppet government in Kabul. Victory was in sight, it seemed. The US Central Intelligence Agency was equally certain of victory.

In early 1989, the ISI commanded the mujahideen to lay siege to Jalalabad. It was a disastrous mistake. Moscow poured weapons into the battlefield and the communist Afghans held their ground. The mujahideen were slaughtered and turned to infighting. Instead of a decisive victory, the ISI was stalemated. Benazir sacked Gul. Gul blamed the Americans, claiming that they had somehow betrayed the cause.

As director general of the ISI, Gul also devoted major resources to the India front, as Zia wanted. The ISI trained Muslim and Sikh terrorists. Gul was a godfather for the creation of the Lashkar-e-Toiba and a close associate of Hafiz Saeed. The jihad grew stronger on two fronts, east and west.

After leaving the army in 1991-92, Gul became an apologist for jihadist terrorism. He met with Osama bin Laden (who had worked closely with the ISI in the war against the Soviets) and became an ardent supporter of al-Qaeda. After the attacks of September 11, 2001, he initially blamed the attacks on the US on an inside job conducted by the Mossad, the Israeli intelligence agency. When the US Navy Seals found bin Laden hiding in the frontyard of the Pakistan Military Academy on Kakul road in Abbottabad, Gul claimed he had really been killed in Afghanistan. The US reportedly asked the United Nations to label him a supporter of terror but the Chinese, the Pakistan army’s protector, vetoed it.

Gul also pursued a vendetta against Benazir. He helped orchestrate her removal from the prime minister’s office in 1990. She accused him of supporting assassination plots against her. He gloated at her death, for which al-Qaeda claimed credit.

The Zia era transformed Pakistan into a factory for jihad. The army itself became a state within the state committed to patronship of jihadist causes. And Gul was a central figure in that project.

Today, the ISI remains a major patron of terror. Afghanistan President Ashraf Ghani accused it this month of running bomb factories and training camps for the Afghan Taliban — another favourite of Gul — to terrorise Kabul and other Afghan cities. The ISI suppressed news of the death of Taliban founder Mullah Omar in a Karachi hospital for two years in order to manipulate the Afghan insurgency behind the scenes, much like the wizard of Oz. The LeT remains another major beneficiary of the ISI and army generals. It attacked India’s consulate in Herat, Afghanistan, just over a year ago.

At the same time, some of the jihadis have turned on their patrons. A year ago, bin Laden’s al-Qaeda attempted its most audacious terror plot in over a decade — an attempt to hijack a Chinese-built Pakistan navy frigate named the Zulfiqar. The plan was to seize the frigate with al-Qaeda recruited members of the Pakistan navy, take the ship into the Arabian Sea and attack an American aircraft carrier or other suitable target.

The goal was to spark a war between the US and Pakistan, a history-changing terror attack even bigger than 9/11. Bold and dangerous, it was a vintage al-Qaeda plot, truly worthy of bin Laden’s disciples. Thankfully it was foiled.

Gul failed the mujahideen at Jalalabad, and the result was the war without end in Afghanistan. Inevitably, it has spilled over into Pakistan, bringing decades of terror and violence. But the army he was a product of continues to play both sides of the war on terror.

This piece was originally published by The Indian Express.