A Nigerian man said Wednesday he tried to bring down an international flight over Detroit with a bomb in his underwear in retaliation for the killing of Muslims worldwide, taking a federal court by surprise as he pleaded guilty on the second day of his trial.

Umar Farouk Abdulmutallab, who had never denied the accusations against him, calmly answered questions from U.S. District Judge Nancy Edmunds before pleading guilty to all eight charges he faced, including conspiracy to commit terrorism and attempted use of a weapon of mass destruction.