When the Soviet Union invaded Afghanistan in 1979, Pakistan’s Inter-Services Intelligence oversaw the recruitment and training of jihadists from Pakistan, Afghanistan and other Islamic countries to fight against Soviet troops. The Soviet Army’s withdrawal from Afghanistan in 1989, at the end of a decade-long war, was seen as a major victory for jihadi fighters and for the I.S.I., which came to view it as proof that jihad was viable as a military strategy. At the I.S.I.’s direction, according to Indian officials as well as Pakistani scholars, jihadi groups in Pakistan shifted their attention to a new, supposedly Islamic cause: liberating Kashmir from Indian rule. Their goal was to embolden Muslim separatists in Kashmir by carrying out terrorist attacks against India. A prominent group assigned to the task was the Harkat-ul-Mujahedeen, and one of its new members in 1989 was a bright 20-year-old son of a government schoolteacher who had graduated from a seminary in Karachi. His name was Masood Azhar.

The Harkat-ul-Mujahedeen sent Azhar to train at a camp in Afghanistan. The instructors discovered that his physical capabilities didn’t quite match his ideological fervor. Despite being in his early 20s, he was soft around the middle, not quite cut out for the rigors of jihadi boot camp. And so, after he was there for a week and learned the basics of firing a Kalashnikov, the trainers exempted him from the remainder of the 40-day course. Harkat-ul-Mujahedeen’s leader decided that Azhar’s talents would be better exploited in producing a monthly magazine on behalf of the organization called Sadai-e-Mujahid (Voice of the Mujahid).

With a print run of about 1,000, nearly all of which were distributed free at mosques, the magazine detailed the heroic accomplishments of the mujahedeen in Afghanistan, inspiring a reverence among mosque-goers that translated into a steady stream of new recruits for the group. And the publication of the group’s bank account number in each issue helped bring in substantial donations every year. The magazine’s success quickly propelled Azhar into Harkat-ul-Mujahedeen’s leadership ranks. He was also proving himself to be a gifted orator. On trips to Saudi Arabia, the United Arab Emirates, Zambia and Britain, he delivered passionate speeches exhorting audiences at mosques and seminaries to do their part for jihad, which brought funds pouring into the group’s coffers. An account of his British tour in the September 1993 issue of Sadai-e-Mujahid describes a series of sermons at mosques across Britain, with titles like “Virgins Yearn Badly for Martyrs.”

By this time, Azhar had begun working directly on the cause in Kashmir, where India’s efforts to crush a popular uprising through brute force were backfiring. Indian soldiers, seen by many in the Kashmir Valley as an occupying force, had been accused of large-scale abuses — rape, torture and, in some cases, disappearing men suspected of having links to militant groups. The brutalities left many seething. Azhar visited towns in Pakistan-administered Kashmir (also referred to as Azad Kashmir) to deliver public lectures urging young men to join the fight against Indian security forces across the Line of Control.

In 1994, Azhar, using a Portuguese passport, traveled to Srinagar and met with a militant commander in Kashmir named Sajjad Afghani, a veteran of the Soviet-Afghan war. On Feb. 11, Azhar and Afghani were driving back from a meeting when their car ran out of gas. They hailed an auto-rickshaw to get to a gas station, but the vehicle was intercepted at an army checkpoint. Azhar and Afghani were sent to a prison in Jammu whose inmates included several Pakistani and Kashmiri militants.

In prison, Azhar’s preaching quickly gained him a following. A visitor who came to see him regularly was Avinash Mohananey, at the time a senior official in India’s Intelligence Bureau. Last year in New Delhi, I met with Mohananey, who is now retired. He described Azhar as a pleasant conversationalist who was always cooperative. Once, after being slapped by an army official who had come to question him in prison, Azhar complained to Mohananey in language that, at least in Mohananey’s view, suggested a desire for self-preservation at odds with Azhar’s promotion of violent jihad. “Even my father has never slapped me,” Mohananey recounted Azhar saying. When I heard that, I wondered if it wasn’t more a reflection of wounded pride than an indication of cowardice.

Over the course of these conversations, Mohananey said, Azhar shared details that enabled Mohananey and his colleagues to learn how terrorist outfits in Pakistan were operating. The groups ran charity organizations that raised money from businesses as well as individuals — going door to door to ask people to donate hides from animals sacrificed for the religious festival of Eid, for instance, which were then auctioned. Only a small fraction of the funds raised was used for charity, he explained; a considerable part was spent on recruiting jihadists. Whenever a militant was killed by Indian security forces, Azhar told Mohananey, the organization’s leaders would visit the family of the deceased and honor his memory in a public gathering.