Updated

The Somali-born teenager who was arrested in a sting operation while trying to blow up a van he believed was loaded with explosives at a crowded Christmas tree lighting ceremony in Portland, Ore., e-mailed an alleged terrorist last year, authorities said.

U.S. Attorney Dwight Holton released federal court documents to The Associated Press and the Oregonian newspaper that show the sting operation began in June after an undercover agent learned that 19-year-old Mohamed Osman Mohamud had been in regular e-mail contact with an "unindicted associate" in Pakistan's northwest, a frontier region where Al Qaeda and Afghanistan's Taliban insurgents are strong.

An FBI document reveals that Mohamud had contact with the suspected terrorist in Aug. 2009. In Dec. 2009, Mohamud discussed the possibility of traveling to Pakistan to engage in violent jihad.

Mohamud was arrested at 5:40 p.m. Friday just after he dialed a cell phone that he thought would set off the blast but instead brought federal agents and police swooping down on him. The bomb was an elaborate fake supplied by the agents and the public was never in danger, authorities said.

Yelling "Allahu Akbar!" -- Arabic for "God is great!" -- Mohamud tried to kick agents and police after he was taken into custody, according to prosecutors.

"The threat was very real," said Arthur Balizan, special agent in charge of the FBI in Oregon. "Our investigation shows that Mohamud was absolutely committed to carrying out an attack on a very grand scale,"

A law enforcement official, who was not authorized to discuss the investigation publicly and spoke on condition of anonymity, told The Associated Press on Saturday that federal agents began investigating the suspect after receiving a tip from someone who was concerned about the teenager.

The FBI affidavit that outlined the investigation alleges that Mohamud planned the attack for months, at one point mailing bomb components to FBI operatives, whom he believed were assembling the device.

According to the official, Mohamud hatched the plan on his own and without any instruction from a foreign terrorist organization, and he planned the details, including where to park the van for the maximum number of casualties.

The affidavit said Mohamud was warned several times about the seriousness of his plan, that women and children could be killed, 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."

Mohamud, a naturalized U.S. citizen living in Corvallis, 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. Few details were available about him late Friday.

Authorities allowed the plot to proceed in order to build up enough evidence to charge the suspect with attempt.

Officials didn't say if the suspect had any ties to other Americans recently accused of trying to carry out attacks on U.S. soil, including alleged efforts in May by a Pakistan-born man to set off a car bomb near Times Square or another Pakistan-born Virginia resident accused last month in a bomb plot to kill commuters.

The two used coded language in which the FBI believes Mohamud discussed traveling to Pakistan to prepare for "violent jihad," the documents said.

In June an FBI agent contacted Mohamud "under the guise of being affiliated with" the suspected terrorist. But the documents did not say how federal officials first became aware of Mohamud.

An undercover agent met with him a month later in Portland, where they "discussed violent jihad," according to the court documents.

As a trial run, Mohamud and agents detonated a bomb in Lincoln City, Ore., earlier this month.

"This defendant's chilling determination is a stark reminder that there are people -- even here in Oregon -- who are determined to kill Americans," Holton said.

Friday, an 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 left the van near the downtown ceremony site and went to a train station where Mohamud was given a cell phone that 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.

Omar Jamal, first secretary to the Somali mission to the United Nations, condemned the plot and urged Somalis to cooperate with police and the FBI.

"Talk to them and tell them what you know so we can all be safe," Jamal said.

Somalia Foreign Minister Mohamed Abullahi Omaar said his government is "ready and willing" to offer the U.S. any assistance it may need to prevent similar attempts. He said the attempt in Portland was a tragedy for Mohamud's family and the "people he tried to harm."

"Mohamud's attempt is neither representative nor an example of Somalis. Somalis are peace loving people," said Omaar, whose government is holed up in a few blocks of the capital, Mogadishu, while much of the country's southern and central regions are ruled by Islamist insurgents.

Tens of thousands of Somalis have resettled in the United States since their country plunged into lawlessness in 1991, and the U.S. 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 Qaeda affiliated group in Mohamud's native Somalia,

At the time, Attorney General Eric Holder said the indictments reflect a disturbing trend of recruitment efforts targeting U.S. residents to become terrorists.

Officials have been working with Muslim community leaders across the United States, particularly in Somali diasporas in Minnesota, trying to combat the radicalization.

The alleged plot in Portland follows a string of terrorist attack planning by U.S. citizens or residents.

In the Times Square plot, Faisal Shahzad allegedly tried to set off a car bomb at a bustling street corner. U.S. authorities had no intelligence about Shahzad's plot until the smoking car turned up in Manhattan.

Late last month, Farooque Ahmed, 34, of Virginia was arrested and accused of casing Washington-area subway stations in what he thought was an al-Qaida plot to bomb and kill commuters. Similar to the Portland sting, the bombing plot was a ruse conducted over the past six months by federal officials.

A year ago in another federal sting, 19-year-old Jordanian Hosam Smadi was arrested on charges he intended to bomb a downtown Dallas skyscraper. Federal officials said he placed what he believed was a car bomb outside the building but was instead a decoy device given him by an undercover FBI agent.

"I think we've been extremely lucky so far in the United States that many of the incidents have been amateur," said Bruce Hoffman, terrorism expert at Georgetown University. "But even if their skill level is not enough that they can pull off a successful attack, what is clear that the intention or motivation to cause mass homicide or destruction is certainly genuine."

The Associated Press contributed to this report.