PORTLAND, Ore. — A Somali-born teenager plotted “a spectacular show” of terrorism for months, saying he didn’t mind that children would die if he bombed a crowded Christmas tree-lighting ceremony, according to a law-enforcement official and court documents.

He never got the chance.

Mohamed Osman Mohamud, 19, was arrested Friday in downtown Portland after using a cell phone to try to detonate what he thought were explosives in a van, prosecutors said.

It turned out to be a dummy bomb put together by FBI agents, and authorities said the public was never in danger.

The case is the latest in a string of alleged terrorist planning by U.S. citizens or residents, including a Times Square plot in which a Pakistan-born man pleaded guilty earlier this year to trying to set off a car bomb at a bustling street corner.

In the Portland plot, Mohamud believed he was receiving help from a larger ring of jihadists as he communicated with undercover agents, but a law-enforcement official who wasn’t authorized to discuss the case publicly and spoke on condition of anonymity said that no foreign terrorist organization was directing him.

The official said Mohamud was committed to the plot and planned details alone, including where to park the van to hurt the most people.

“I want whoever is attending that event to leave, to leave dead or injured,” Mohamud said, according to the affidavit.

Thousands of people had gathered Friday on a cold, clear night for the event at Pioneer Courthouse Square, often referred to as “Portland’s living room” because of its popularity.

Ten minutes before Mohamud’s 5:40 p.m. arrest, the lighting began. Babies sat on shoulders, and children cheered at Santa Claus’ first appearance onstage.

The tree-lighting on the bricks of the plaza went off without a hitch just as the arrest was taking place.

‘A SPECTACULAR SHOW’

Mohamud, who grew up in Beaverton, was enrolled in courses at Oregon State University from late 2009 until Oct. 6 before withdrawing, said university spokesman Todd Simmons.

The law-enforcement official who spoke to the AP said agents began investigating Mohamud after receiving a tip from someone concerned about him. The official declined to offer more detail about the relationship between the two.

The FBI monitored Mohamud’s e-mail and found he was in contact with people overseas, asking how he could travel to Pakistan and join the fight for jihad, according to an FBI affidavit.

The law enforcement official said Mohamud e-mailed a friend living in Pakistan who had been a student in Oregon in 2007-2008 and had been in Yemen as well.

The e-mail exchanges led the FBI to believe that Mohamud’s friend in Pakistan “had joined others involved in terrorist activities” and was inviting Mohamud to join him, according to the affidavit.

For reasons unexplained, Mohamud tried to board a flight to Kodiak, Alaska, from Portland on June 14, wasn’t allowed to board and was interviewed by the FBI, the affidavit states. Mohamud told the FBI he had previously hoped to go to Yemen but had never obtained a ticket or a visa.

On June 23, an agent e-mailed Mohamud, pretending to be affiliated with the “unindicted associate,” the former student.

The affidavit said Mohamud was warned several times about the seriousness of his plan, that women and children could die, and that he could back out. But he told agents: “Since I was 15 I thought about all this,” and “It’s gonna be a fireworks show … a spectacular show.”

OBAMA AIDE: PUBLIC NOT IN DANGER

Mohamud, a naturalized U.S. citizen, was charged with attempted use of a weapon of mass destruction, which carries a maximum sentence of life in prison. A court appearance was set for Monday.

Authorities let the plot proceed in order to build up enough evidence to charge the suspect with attempt, and White House spokesman Nick Shapiro said Saturday that President Obama was aware of the FBI operation before Friday’s arrest. Shapiro said Obama was assured that the public was not in danger.

Authorities said Mohamud sent bomb components to undercover agents who he believed were assembling the explosive device, but the agents supplied the fake bomb that Mohamud tried to detonate twice via phone.

The FBI affidavit said the undercover agent first met Mohamud in person on July 30 and asked what he would do for the cause of jihad, suggesting he might want to spread Islam to others, continue studies to help the cause overseas, raise money, become “operational” or become a martyr. Mohamud responded that he wanted to become “operational,” but needed training, the affidavit said.

When Mohamud was asked what he meant by “operational,” he responded that he wanted to put together an explosion, the affidavit stated. The undercover agent asked Mohamud to research potential targets.

At a second meeting on Aug. 19 at a Portland hotel, the agent brought a second undercover agent, the documents said, and Mohamud told them he had selected Portland’s Pioneer Courthouse Square for the bombing.

On Nov. 4, the court documents say, Mohamud made a video in one agent’s presence.

He read a statement speaking of his dream of bringing “a dark day” on Americans and blaming his family for thwarting him, according to the court documents:

“To my parents who held me back from Jihad in the cause of Allah. I say to them … if you – if you make allies with the enemy, then Allah’s power … will ask you about that on the day of judgment … ”

Friday, an agent and Mohamud drove to Portland with six 55-gallon drums with detonation cords and plastic caps, but they were all inert, the complaint states.

They left the van near the downtown ceremony site and went to a train station where Mohamud was given a cell phone he thought would blow up the vehicle, according to the complaint. There was no detonation when he dialed, and when he tried again, federal agents and police made their move.

Tens of thousands of Somalis have resettled in the United States since their country plunged into lawlessness in 1991, and the United States has boosted aid to the country.

In August, the U.S. Justice Department unsealed an indictment naming 14 people accused of being a deadly pipeline routing money and fighters from the U.S. to al-Shabab, an al-Qaida affiliated group in Somalia.

SOMALI COMMUNITIES ON EDGE

Officials have worked with Muslim community leaders across the United States, trying to stem the radicalization.

On Saturday, Omar Jamal, first secretary to the Somali mission to the United Nations and an advocate for Somalis in the Minnesota diaspora, said Mohamud has a stepmother in Minneapolis. He condemned the plot and urged Somalis to cooperate with police and the FBI.

Jamal said he’d spoken to two Somalis who knew Mohamud, and they described him as religious and quiet.

“Everybody’s afraid, really, really afraid,” Jamal said of members of Somali communities, both in Oregon and elsewhere. “They’re afraid of, first of all, the label. The allegation is very serious …”