Updated

The immigrant from Bangladesh charged in a recent failed suicide bombing in New York City was scheduled to appear in court Wednesday to face charges related to the attempted attack.

Akayed Ullah, 27, was arrested soon after the bomb attached to his body exploded Monday morning in a subway passageway near the Port Authority Bus Terminal in Midtown Manhattan.

Ullah, who was living in Brooklyn, was charged with providing material support to a terrorist group, use of a weapon of mass destruction and three other bomb-related counts. He faces up to life in prison if convicted.

With a pipe bomb strapped to his body and ready to maximize casualities, Ullah allegedly targeted a morning rush hour crowd in attempt to punish the United States for attacking the Islamic State group, acting U.S. Attorney Joon Kim said.

He had apparently "hoped to die in his own misguided rage, taking as many innocent people as he could with him, but through incredible good fortune, his bomb did not seriously injure anyone other than himself," Kim said.

An investigation found that Ullah had been researching how to build a bomb over a year ago and had planned his attack for several weeks, Kim said.

Ullah came to the U.S. in 2011 on a "chain migration" visa and lived in a Bangladeshi community in Brooklyn with his parents and brother.

The Associated Press contributed to this report.