Smoke rises above the Jinnah International Airport, where security forces battled militants June 9, 2014, in Karachi, Pakistan. (AP Photo/Shakil Adil) (AP)

Nisid Hajari is a member of the Bloomberg View editorial board and the author of “Midnight’s Furies: The Deadly Legacy of India’s Partition.”

At the outset of World War II, far from the battlefields of Europe, British colonial officials in India bought themselves a jihad. They secretly spread cash all along the turbulent Afghan frontier, encouraging mullahs in the Islamic tribal region to whip up sentiment against Britain’s enemies: first the godless Soviets and their then-allies the Nazis, later the brutal Japanese and eventually Indian leaders such as Mahatma Gandhi and Jawaharlal Nehru, who were refusing to back the war effort. The strategy was low-cost and surprisingly effective. “In some areas,” marveled Sir George Cunningham, governor of the North-West Frontier Province, “religious Talibs [students] were encouraged to go into the Army — a thing which . . . was unknown before.”

Today, Pakistan — one of two nations born out of the former British India — is paying a high price for pursuing what once seemed like an equally smart and economical strategy. Years of backing for Islamic militants as tools of the state have spawned a hydra-headed monster: Some groups have received official favor to bleed Indian forces in Kashmir; others have turned against their masters, fighting the Pakistani government and costing the lives of an estimated 50,000 soldiers and civilians over the past decade. Insurgents have brazenly attacked army headquarters and an air base thought to house nuclear weapons, among other high-profile targets. Top generals, architects of the proxy strategy, now admit that the militants pose a greater threat to Pakistan’s security than even arch-rival India.

Pakistan should be an object lesson for countries like Saudi Arabia and Iran, which are busily arming their own surrogates in Sunni-Shiite proxy wars from Syria to Iraq to Yemen. These shadow armies may seem like an efficient way to undermine rivals without committing to an official course of war. They’re far easier to raise, though, than they are to rein in.

Pakistan began to learn this lesson barely two months after its founding as an independent nation in August 1947. That fall, a cabal of adventurist Pakistani officials set in motion a plan that involved recruiting Pashtun tribesmen from the frontier region to invade Kashmir, an independent kingdom whose Hindu maharajah was threatening to join rival India — and to take his mostly Muslim subjects with him. To this day, many Indians believe that Pakistan’s founder, Mohammad Ali Jinnah, masterminded the operation. In fact, Jinnah appears to have been unaware of what his subordinates were planning and initially tried to distance himself from the plot in order to preserve his deniability: “Don’t tell me anything about it!” he interjected when an aide tried to brief him about 10 days before the invasion. “My conscience must be clear.”

After Indian troops raced to Kashmir to repel the tribesmen, Jinnah hoped to counter openly, using regular Pakistani units. But British generals — who continued to command the Indian and Pakistani militaries for the first couple of years after independence — feared a wider war and had strict instructions not to fight each other. On Oct. 28, they pressured Jinnah to retract his orders.

A summit meeting was hastily arranged for the next day in Lahore. Jinnah wanted an immediate plebiscite that would allow Kashmir’s citizens, who were overwhelmingly Muslim, to decide which country they preferred to join. Nehru, India’s first prime minister, had already promised to accept the results of any credible vote. The gap between the two sides should have been bridgeable.

At a cabinet meeting in Delhi that evening, however, Nehru’s colleagues rounded on him angrily. “For the prime minister to go crawling to Mr. Jinnah when we were the stronger side and in the right would never be forgiven by the people of India,” declared “Sardar” Vallabhbhai Patel, India’s hard-line home minister. Cowed by the adamant opposition, Nehru took to his bed ill that night “looking very seedy and sorry for himself,” as Lord Louis Mountbatten, governor general of India, recorded. The summit was hastily called off.

Cunningham, who had agreed to serve as governor of the North-West Frontier Province again after independence, saw Jinnah the next morning. The Pakistani leader suspected that Nehru’s cancellation “was just a plot to delay things while more Indian troops were flown into Kashmir,” Cunningham recorded in his diary. “He said he felt his hands were now free, legally as well as morally, to take any line he liked about Kashmir.” If India was not going to play straight, why should Pakistan?

The attractions of a proxy war now became evident. If the tribesmen could tie down Indian forces for two to three months, Pakistan would gain leverage in negotiations at little diplomatic or financial cost. Huddling around the bedside of Pakistani Prime Minister Liaquat Ali Khan, who was recovering from a heart attack, Jinnah and his top aides decided to reinforce the insurgents, sending up drafts to relieve tired fighters and maintaining a contingent of at least 5,000 tribesmen in the Kashmir Valley. The plan was for Pakistani provincial officials to supply arms and ammunition. Cunningham would provide 100,000 rounds from village stockpiles.

The tribesmen would be paid in cash when they came back from the front. Jinnah agreed to enlist a few non-British army officers in the effort, led by Col. Akbar Khan, the director of weapons and stores and one of the original conspirators. They would be put on leave to maintain the fiction that the militants were operating independently.

Still, it was impossible to keep such an operation secret. “Whatever Jinnah and others may say the fullest assistance is in fact being given to the tribesmen,” British diplomat Hugh Stephenson reported to his superiors a few weeks later. Another British diplomat visited Abbottabad, a town near the Kashmir border, and found that “the tribesmen were conspicuous with their rifles over their shoulders, girt with bandoliers and looking thoroughly piratical.”

To keep them focused on fighting India instead of robbing fellow Pakistanis, officials housed the militants on a former stud farm, three miles outside of town. From there a steady stream of trucks departed for the border at night to avoid Indian reconnaissance planes. Members of the ruling Muslim League party openly campaigned for volunteers to defend Kashmir’s Muslims from their tyrant king and his Indian allies.

Top Pakistan army officials knew generally of the scope of operations. The British commander in chief, Gen. Sir Frank Messervy, was walking over to Liaquat’s bungalow one night after the insurgency had gotten underway. He “saw a bearded figure rush out of the room where Liaquat was and disappear round the corner of the house. I said to Liaquat, ‘That was Akbar, wasn’t it?’ He hesitated and said, ‘Yes.’ ” The prime minister admitted that several Pakistani officers, including Col. Khan, had been sent to Kashmir to impose some order on the tribal offensive. “I agreed to this,” Messervy later admitted, “and in fact I expect that the number of officers seconded to the tribal forces was increased.”

With Jinnah’s embrace of the tribesmen, any hope of quickly resolving the crisis vanished. The decision prompted wild reports in Delhi, including that the invaders were being “provided with motor transport, automatic weapons, artillery and even flame-throwers.” It confirmed the belief — an article of faith among many Indians today — that Pakistan’s word could not be trusted and that any opposition to Indian rule in Kashmir had to be alien and illegitimate.

Nehru refused to contemplate any plebiscite until all of Pakistan’s “raiders” had been driven from the kingdom. He poured Indian troops into the theater and threatened to withhold Pakistan’s share of the British Raj’s reserves, which was worth nearly $2 billion in today’s dollars.

Indeed, the costs of the operation mounted more quickly than Jinnah had anticipated. After promoting the campaign as a holy war, Pakistan could hardly back down. Yet its fledgling government was essentially running on fumes; by December 1947, only about $65 million (in today’s dollars) were left in its accounts. The jihad, Cunningham told a British diplomat, had “hopelessly undermined all discipline and mutual confidence in the [civil] services,” as junior officials were encouraged to abuse their authority, siphon off equipment, mislead their superiors — anything that could be justified as support for the shadow war.

The threat of escalation loomed, too. After the tribesmen overran an isolated garrison of Indian troops on Dec. 23, a furious Nehru ordered Indian generals to prepare to cross the border. He wanted to wipe out the insurgents’ “bases and nerve centers” in Pakistani territory — a dangerous idea that still rears its head after Pakistan-linked outrages, such as the 2008 Mumbai terror attacks. Only after the United Nations agreed to take up the Kashmir case did Nehru back off from his threat.

That first Kashmir war ended with the state effectively partitioned and the strategically valuable Kashmir Valley in the hands of India. Yet over the ensuing decades, Pakistan returned to its tactics again and again. The deployment of anti-India jihadists would lead to two more major conflicts in Kashmir — in 1965 and 1999 — the last of which nearly went nuclear. In the 1990s, Pakistan threw its support behind the Taliban takeover of Afghanistan as well, hoping to block Indian influence in Kabul.

Today, with troops battling the Pakistani Taliban in the wilds of North Waziristan, army leaders are understandably reluctant to add to their challenges by taking on the Afghan Taliban and Kashmir-focused militants such as Lashkar-e-Taiba. Ignoring such groups carries its own costs, however. Official tolerance of Lashkar — whose operational commander, accused of masterminding the Mumbai attacks, was recently set free on bail — continues to poison relations with India. Cross-border attacks in the Indian half of Kashmir last year derailed tentative talks between the two sides; they’ve yet to be fully revived.

Meanwhile, the Afghan Taliban has undermined a budding rapprochement between Islamabad and the new Afghan government by refusing to come to the negotiating table, instead launching a vicious offensive from its havens inside Pakistan. The ongoing instability threatens $46 billion in infrastructure investments recently pledged by China — a relationship that’s far more vital to Pakistan’s future than the fate of Kashmir or even Afghanistan.

Middle Eastern powers are beginning to experience some of the same blowback from their own machinations. It’s now clear that the money Saudi Arabia and other Persian Gulf monarchies poured into Sunni militant groups in Syria inadvertently helped propel the rise of the Islamic State. To their consternation, that’s led to a bizarre scenario in which the United States finds itself fighting the Islamic State in Iraq alongside Shiite militias backed by Iran. Rather than toppling Syrian dictator Bashar al-Assad, Washington is bombing his enemies.

Nor should Iran take much comfort in its apparent successes. Its Hezbollah proxies may have the upper hand in Syria, and its influence over the Baghdad government may be unmatched. But Tehran’s gains have united Sunni Arab leaders, who have agreed to establish a regional military force implicitly directed against Iran. A nuclear deal that leaves the Iranian enrichment program in place could spur a regional arms race and drive Saudi Arabia to develop its own bomb, possibly with help from Pakistan.

Meanwhile, Iranian leaders appear to be ramping up their support for Houthi rebels in Yemen. If Pakistan’s experience is anything to go by, the last thing they should expect is a clean victory.

Twitter: @NisidHajari

Read more from Outlook and follow our updates on Facebook and Twitter.