DETROIT – A Nigerian man pleaded guilty Wednesday to trying to bring down a jetliner with a bomb in his underwear, defiantly telling a federal judge that he acted in retaliation for the killing of Muslims worldwide and referring to the failed explosive as a “blessed weapon.”

Umar Farouk Abdulmutallab, who acknowledged working for al-Qaida and never denied the allegations, entered the plea against his attorney’s advice on the second day of his trial. He stands to get a mandatory life sentence for the 2009 attack that aimed to kill nearly 300 people on Christmas Day in the skies above Detroit.

Abdulmutallab calmly answered the judge’s questions and read a political statement warning that if the United States continues “to persist and promote the blasphemy of Muhammad and the prophets,” it risks “a great calamity … through the hands of the mujahedeen soon.”

“If you laugh at us now, we will laugh at you later on the day of judgment,” he said.

Abdulmutallab suggested more than a year ago that he wanted to plead guilty but never did. He dropped his four-person, publicly financed defense team in favor of representing himself with help from a prominent local lawyer appointed by the court, Anthony Chambers.

In an interview, Chambers said Abdulmutallab privately renewed his interest in a guilty plea Tuesday before the start of the trial. But it did not happen immediately because the defendant was not prepared to go through the lengthy required question-and-answer session with the judge.

When the two met again Wednesday morning, Abdulmutallab was ready, Chambers said.

Prosecutors were aware of a possible plea, but there were no negotiations. Abdulmutallab had “no interest” in speaking to prosecutors, Chambers said, and was unlikely to get any benefit at this stage of the case.

Chambers wanted to go to trial to raise doubts about just how powerful the explosive was. And if Abdulmutallab were convicted, there was also a possible appeal involving the lack of a Miranda warning before a crucial FBI interview.

“I don’t think there was anything done (at trial) that made him say, ‘This is a done deal. I have to take a plea,’” Chambers said.