Updated

PORTLAND, Ore. -- A Somali-born teenager plotted to carry out a car bomb attack at a crowded Christmas tree lighting ceremony in downtown Portland on Friday, but the bomb turned out to be a dud supplied by undercover agents as part of a sting, federal prosecutors said.

Mohamed Osman Mohamud, 19, was arrested at 5:40 p.m. just after he dialed a cell phone that he thought would blow up a van laden with explosives but instead brought federal agents and Portland police swooping in to take him into custody.

Mohamud yelled "Allahu Akhkbar" and tried to kick agents and police as the arrest came, according to prosecutors.

He was charged with attempted use of a weapon of mass destruction.

U.S. Attorney Dwight Holton released federal court documents Friday that show the sting operation began in June after an undercover agent learned that Mohamud had been in contact with an "unindicted associate" in Pakistan's Northwest Frontier region.

Mohamud is a naturalized U.S. citizen who has been living in Corvallis.

According to a federal complaint, Mohamud was in regular email contact with the "unindicted associate' in Pakistan's Northwest Frontier starting in August 2009.

The complaint states that in December 2009 Mohamud and the "unindicted associate" used coded language in an email in which the FBI believes Mohamud discussed traveling to Pakistan to prepare for "violent jihad."

The document says in the months that followed Mohamud made 'multiple efforts" to contact another "undicted associate" to arrange travel to Pakistan but had a faulty email address for that person.

Last June an FBI agent contacted Mohamud "under the guise of being affiliated with the first associate."

Mohamud and the undercover agent agreed to meet in Portland on July 30. At that meeting, the undercover agent and Mohamud "discussed violent jihad," according to the court document.

Mohamud told the agent he wanted to set off explosives at the annual Christmas tree lighting ceremony in Portland's Pioneer Courthouse Square, an event that occurred on Friday.

On Friday, an undercover agent and Mohamud drove to downtown Portland in a white van that carried six 55-gallon drums with detonation cords and plastic caps, but all of them were inert, the complaint states.

They got out of the van and walked to meet another undercover agent, who drove to Union Station, the Portland train station, where Mohamud was given a cell phone that he thought would blow up the van, according to the complaint.

Mohamud dialed the phone agents had given him, and was told the bomb did not detonate. The undercover agents suggested he get out of the car and try again to improve the signal, when he did, he was arrested, the complaint said.