It all started with a mobile phone, dropped at a petrol station robbery in Torrance, California, in July 2005.
"Through the phone we came up with a name, a residence and the location of the suspects," says Torrance police officer Dave Crespin.
"We arrested the suspects and conducted a search warrant on an apartment in South Los Angeles."
There had been a string of robberies in the area, mostly with the same MO; a getaway driver and another with a shotgun. But once on the premises detectives realised this was far bigger than a robbery and contacted the FBI.
The apartment, rented by suspects Levar Hanley Washington, a prison parolee, and Gregory Patterson, who had no criminal record, contained a trove of incriminating material that allegedly suggested the hapless robbers aspired to become terrorists.
Among material used to charge the men and two accomplices was a handwritten document called "Blueprint 2005", which cited eight tasks, such as obtaining silencers for pistols and bombs that can be activated from a distance. Another document, "Modes of Attack", listed local targets.
The investigation led to California's New Folsom Prison and the cell of Kevin Lamar James, where investigators found the draft of a sinister press release.
Titled "Notoriety Moves", it outlined violent jihad in Southern California, and was allegedly due to be disseminated after the attacks began.
"This incident is the first in a series of incidents to come in a plight to defend and propagate traditional Islam in its purity," it read. "Sincere Muslims" were advised to avoid targets, including Jewish and non-Jewish supporters of an Israeli state.
Possible targets included a military recruitment office and National Guard facilities, synagogues, the Israeli consulate, the El Al desk at Los Angeles International Airport, and a mysterious "Campsite of Zion".
"Their plans were to enter either a recruiting facility or a synagogue and shoot as many people as possible before fleeing," says US attorney Gregory Staples, who helped to prosecute the case.
Last week James, 30, and Washington, 29, pleaded guilty in a Californian court to conspiring "to wage war against the Government of the United States through terrorism".
Patterson, 23, followed suit on Monday. All three are African-Americans. Their alleged co-conspirator, Hammad Samana, a Pakistani citizen with no criminal record, is receiving psychiatric care in a federal prison and hasn't made a plea.
All four belonged to an obscure Islamic group called Jamiyyat Ul-Islam Is-Saheeh, or JIS, the Assembly of Authentic Islam, which James founded in Folsom in 1997.
The plot allegedly started with the creation of JIS.
In 103 pages of handwritten text, some of it in Arabic, James set out the JIS protocols for followers. They are advised to demonstrate "obedience to established authority" and to be "esoteric or clandestine" in their activities. They also had a duty to attack infidels, including Israel and the US.
Washington, serving time in Folsom for assault and robbery, was recruited to JIS by James, his cellmate, in 2004.
Patterson was also a convert. According to a 2005 federal indictment, James directed the plotters from his cell. Their plans began to heat up in 2004 after Washington was paroled.
He subsequently recruited Patterson, with whom he attended a LA mosque, and Samana, making them swear allegiance to JIS. Authorities say Washington planned to finance the plot by robbing gas stations. Ten were hit. Samana allegedly researched the Modes of Attack targets.
For federal authorities it was a rare success following several judicial setbacks in other terrorism cases, including a Miami jury who last week acquitted a man accused of trying to blow up the Sears Tower in Chicago.
"At the time of their arrest, it appeared they were on the verge of staging an attack here in Los Angeles," said Thomas O'Brien, the US Attorney in Los Angeles. "An untold number of lives may have been saved when this terrorist cell was dismantled."
While prosecutors say a "couple of other guys" in LA were associated with JIS, no one else was indicted and JIS has been rolled up.
The case leaves several intriguing questions unanswered. California has seen other violent black radicals, such as the Symbionese Liberation Army and the Black Panthers, but the JIS adherents are the first inspired by Osama bin Laden's al Qaeda.
JIS also involves people with criminal records, and fuels concerns that US prisons may have become a terrorist recruiting ground.
Blacks are disproportionately represented among America's two million inmates, and some are young and Muslim converts.
In the past, many Muslim prisoners were actually model inmates, says Brian Levin, director of Cal State University's Centre for the Study of Hate and Extremism.
"But what we've seen is, I think, an effort by al Qaeda at radicalisation. Particularly of young people in countries they'd like to target."
FBI Special Agent Richard Kolko said prison radicalisation throughout the country was a big issue.
In letters James wrote that he "jumped for joy when he saw the 9/11 attacks on TV", says Staples and had bin Laden's picture in his cell.
While a Pew Research Centre survey in May concluded the majority of America's 2.35 million Muslims, of whom 20 per cent of are African American, were "highly assimilated" into US culture and held moderate political views, it noted that "fewer native-born African Americans completely condemn al Qaeda".
Younger US Muslims also felt suicide bombers were sometimes justified, and a majority of US Muslims rejected the line that Arabs carried out the 9/11 attacks.
Compared with the 9/11 attacks, the JIS cell seems amateurish. Nonetheless, the JIS plot is the largest publicly known terrorist scheme to be aimed at California since the Millennium Plot to attack Los Angeles Airport in 2000.
In the end, the authorities got lucky. But for that dropped mobile phone, the JIS team may well have carried out its threats.