Updated

The man accused of trying to blow up a Detroit-bound airliner with explosives hidden in his underwear pleaded guilty Wednesday and said the U.S. should "be warned."

Nigerian Umar Farouk Abdulmutallab is accused of trying to blow up Northwest Airlines Flight 253 with a bomb in his underwear on Dec. 25, 2009.

Abdulmutallab, 25, told a Detroit courtroom on Wednesday that the bomb was a "blessed weapon to save the lives of innocent Muslims."

"I intended to wreck a U.S. aircraft for the U.S. wreckage of Muslim lands and property," he said.

The bomb didn't work, and Abdulmutallab was badly burned. Hours later in the hospital, he told the FBI that he was working for Al Qaeda in Yemen.

More On This...

U.S. District Judge Nancy Edmunds reviewed the charges and possible penalties with Abdulmutallab before he entered his pleas, including that he faces a sentence of up to life in prison.

The eight charges against him include conspiracy to commit an act of terrorism and attempted murder on an aircraft. Abdulmutallab told Edmunds that he wants to plead guilty to all charges.

"Are you therefore pleading guilty freely and voluntarily?" Edmunds asked.

"That's right, yes," Abdulmutallab replied.

Abdulmutallab told the courtroom he made an agreement with at least one person to carry out the attack in retaliation for U.S. support of Israel and for what he described as the killings of Muslims in Yemen, Iraq, Somalia and other countries in the Middle East. He attempted to justify the attack as "an eye for an eye, tooth for a tooth."

"The United States should be warned that if they continue to persist and promote the blasphemy of Mohammed and the prophets ... the United States should await a great calamity that will befall them through the hands of the mujahedeen soon," Abdulmutallab said.

His last words as he left the courtroom were "Allah Akbar."

On Tuesday, passengers on the flight testified that Abdulmutallab took a long bathroom break in the plane, during which prosecutors say he was preparing for martyrdom.

He took a small bag to the bathroom and was gone 10 to 15 minutes, according to passenger Mike Zantow, the first witness in Abdulmutallab's terrorism trial.

"I thought he was freshening up for arrival in Detroit. ... We had less than an hour to go," Zantow said.

A prosecutor said Abdulmutallab was performing a cleansing ritual to prepare for death.

Fox News' Ruth Ravve and Marla Cichowski and the Associated Press contributed to this report.