Born and raised in Britain, Junaid Hussain was an accomplished computer hacker, winning notoriety for posting former Prime Minister Tony Blair's personal information online and for blocking a police anti-terrorism hotline.
After six months in prison, the stocky 19-year-old fled gritty Birmingham in 2013 for the Syrian desert. There he put his digital skills to work for the extremist Sunni group that the world would later know as Islamic State.
Within months, Hussain was leading a dozen cyber recruiters who U.S. officials called the "Raqqa 12" or "The Legion." Using a web of social media accounts and encrypted messaging apps, and a multitude of languages, they directed or inspired sympathizers around the globe to join the militants on the battlefield or to launch murderous plots at home.
By mid-2015, the digital jihadis had helped lure thousands of followers to Islamic State's self-declared caliphate in Syria and Iraq — and scores of Americans to try to join or support them, according to FBI Director James B. Comey.
In a speech last month at the University of Texas, Comey recalled how FBI agents raced to track and arrest what he called an "explosion" of potential terrorists across the United States, with investigations in every state that year.
"The FBI was strapped," he said. "We were following, attempting to follow, to cover electronically with court orders, or cover physically, dozens and dozens and dozens of people who we assessed were on the cusp of violence."
The perilous period is only now coming into focus as dozens of criminal cases have gone through the courts, and as current and former FBI agents feel free to describe the desperate chase.
Of the 117 people arrested on U.S. criminal charges tied to Islamic State since January 2014, when the Sunni extremist group first burst into the headlines, more than half were nabbed in 2015, according to the George Washington University's program on extremism.
Driving the FBI hunt was the understanding that Islamic State's cyber team not only was filling the militants' ranks for war — but was inspiring the kind of "lone wolf" terrorists who would carry out the December 2015 mass shooting in San Bernardino and the June 2016 massacre at the Pulse nightclub in Orlando, Fla.
Like Hussain, many of his fellow recruiters came from Europe and understood Western culture, making it easy to approach their marks. They boasted of the glories of the caliphate and life in a war zone, which some recruits found beguiling.
"They really had the ability to find through social media those who were vulnerable," said Mary McCord, acting chief of the Justice Department's national security division.
"Hussain, in particular, had a knack for seeking out vulnerable people and going right at them," she added.
After arriving in Syria, Hussain had adopted the nom de guerre Abu Hussain Britani and the persona of a hipster thug. His Twitter avatar was a photograph of himself aiming a rifle, his face partially obscured with a scarf.
He boosted his profile by marrying Sally Jones, a former British punk rock musician whom he met online and who was given the moniker "Mrs. Terror" in the London press.
Hussain's stature only rose in early 2015 when his team hacked Twitter and YouTube accounts used by U.S. Central Command, the Pentagon arm that conducts the war in Iraq and Syria, and posted taunting propaganda on them.
He also used Twitter to troll for recruits. In 2014 and 2015, he traded emails, tweets or texts with dozens of Americans, ranging from curious teenagers to zealots willing to kill and die for jihad, according to current and former U.S. officials.
In all, Hussain communicated with least nine people who later were arrested or killed by U.S. law enforcement, according to court filings.
One of the first was Munir Abdulkader, a 21-year-old college dropout in Cincinnati who posted videos of gruesome beheadings and confidently tweeted in September 2014 that Islamic State would "rule the world."
After Abdulkader decided he wanted to go to Syria, he found Hussain on Twitter and began a dialogue with him.
U.S. and allied law enforcement and intelligence agencies were increasingly grabbing Syria-bound recruits, so the pair shifted gears. They decided Abdulkader should kidnap a U.S. soldier, record his beheading and then attack a local police station with guns and pipe bombs, according to court records.
Hussain sent Abdulkader the home address of a U.S. soldier and tips on how to conduct reconnaissance. When Abdulkader wrote that he did well at target practice, Hussain replied with a smiley-face emoticon, a federal prosecutor later told a court hearing.
The FBI initially tracked Abdulkader by secretly monitoring Hussain's Twitter direct messages. But agents were stymied when the suspects switched to apps that encrypt messages so they can only be read by sender and receiver.
The FBI sent in an undercover informant, who befriended Abdulkader and recorded his conversations. The informant accompanied Abdulkader to a Wal-Mart to buy weapons and watched as he exchanged encrypted messages with Hussain, according to FBI officials.
The FBI arrested Abdulkader in May 2015. He pleaded guilty to attempting to kill police officers and U.S. government employees and conspiracy to provide material support to a foreign terrorist organization, and was sentenced to 20 years in prison.
Hussain also sought to target Pamela Geller, head of a group that was sponsoring a "Draw Muhammad" contest in Garland, Texas, in May 2015. The event was deliberately provocative since depictions of Muhammad are offensive to many Muslims.
Hussain initially pressed Usaamah Abdulla Rahim, a 26-year-old man Boston-area man, to kill Geller. Rahim bought several knives, which Hussain urged him to carry in case he was confronted by the "feds," Hussain later tweeted.
Rahim eventually decided to kill police. When a Boston police officer and FBI agent approached him in a pharmacy parking lot on June 2, 2015, he pulled out a 13-inch knife that police said he refused to drop. The officers shot him dead.
But Hussain had joined another plot against the "Draw Muhammad" contest, according to the FBI.
In April 2015, he exchanged direct messages over Twitter with Elton Simpson, a 30-year-old Arizona man, about using an encrypted app, according to court records and FBI officials.
"Do you mind if I add you to surespot," Simpson asked Hussain, referring to an encrypted application. "No problem," Hussain replied.
Two weeks later, Simpson and Nadir Soofi put on body armor and drove to the event in Garland. When they emerged from their car brandishing pistols and rifles, police shot them dead.
FBI officials said one of the two exchanged at least 100 encrypted messages hours earlier with someone in Islamic State whom they have not identified. Agents are still unable to read those messages.
Hussain also was in contact with Ardet Ferizi, a 19-year-old Kosovo-born man in Malaysia who used the handle Th3Dir3ctorY.
In June 2015, Ferizi had hacked the website of a major U.S. retailer and stolen personal details on more than 100,000 customers. He culled the list to about 1,300 U.S. military members and government personnel, and passed the cache to Hussain as a potential hit list.
On Aug. 11, 2015, Hussain posted identifying details on the 1,300 on Twitter in the name of the Islamic State Hacking Division, according to court documents.
"We have your names and addresses, we are in your emails and social media accounts," he tweeted, warning that Islamic State would "strike at your necks in your own lands!"
But U.S. and allied intelligence were closing in.
Malaysian police arrested Ferizi that October on a U.S. warrant and he was extradited to Virginia. He later pleaded guilty to providing material support to a foreign terrorist organization and other federal charges, and was sentenced to 20 years in prison.
By then, U.S. and British authorities were hot on Hussain's trail in Syria. Only 21, he was high on a U.S. list for targeted killings.
On Aug. 24, 2015, a U.S. drone launched a missile that killed Hussain near Raqqa. Other drone strikes largely eliminated the initial team of digital recruiters within months.
Since then, Islamic State's online presence has dwindled. It has not rebuilt its cyber wing, likely because it now lacks hackers with the necessary digital and language skills as it struggles with major losses on the battlefield.
But Hussain's digital legacy worries national security officials.
"Hussain and his associates were able to build relationships with their followers while bypassing the U.S. government's ability to monitor him," said Seamus Hughes, deputy director of the George Washington University's program on extremism and coauthor of a recent paper on Hussain and his recruiting team.
"It was simple and brilliant," said Hughes. "The cost benefit was way on their side. Other jihadists know this, and we are likely to see people like them again seeking to inspire or direct attacks."