(CNN) The man accused of blowing up a homemade explosive in a pedestrian subway tunnel in the heart of New York posted on Facebook earlier in the day, saying, "Trump you failed to protect your nation," according to a criminal complaint.
Akayed Ullah, a 27-year-old Bangladeshi man, faces a number of federal and state terrorism charges after he allegedly detonated a device made of a battery, wires, metal screws and a Christmas tree lightbulb during the busy morning commute on Monday.
Five people were treated for minor injuries at area hospitals, while the suspect was said to be seriously injured.
In an interview with investigators, Ullah admitted that he built and detonated the device and said he was inspired to do so by ISIS.
"I did it for the Islamic State," Ullah told investigators, according to the federal complaint.
He faces five federal terrorism-related charges and three state terrorism-related charges, according to court documents.
Here's what we know so far about the explosion and attack:
The blast detonated around 7:20 a.m. in an underground walkway connecting two subway lines beneath the Port Authority Bus Terminal, near Times Square, which accommodates 220,000 passenger trips a day.
The suspect was first spotted on a security camera as he began to climb the subway station stairs to the 18th Avenue F. train platform in Brooklyn at 6:25 a.m., according to one law enforcement official with direct knowledge of the investigation.
He then switched to the A train at Jay St./MetroTech stop in Brooklyn before exiting the train at the Port Authority Bus Terminal stop in Manhattan, the same law enforcement official said.
On grainy surveillance footage, commuters are seen walking through a tunnel when a burst of smoke erupts into the hallway, quickly filling it. Commuters flinch and take cover. When the smoke clears, a man can be seen lying on the ground in the hallway.
According to a law enforcement official, through his comments to investigators, Ullah indicated he was prepared to die. The source also said the suspect was wired up with the self-made device during his entire trip on the subway system.
Akayed Ullah is a Bangladeshi who has been living in the United States since 2011 on an F43 family immigrant visa, according to Department of Homeland Security spokesman Tyler Houlton. He is a lawful permanent resident who lives in Brooklyn and has no criminal record in the United States, according to a preliminary background check.
He had pledged allegiance to ISIS, according to one law enforcement official with direct knowledge of the investigation, and said he acted in response to Israeli actions in Gaza.
Ullah recently carried out electrical work close to the Port Authority along with his brother, who lives in the same apartment building as the suspect, according to law enforcement.
He is at Bellevue Hospital, where he is being treated for lacerations and burns to his hands and abdomen, New York City Fire Department Commissioner Daniel Nigro said. He is said to be seriously injured.
Ullah's ISIS radicalization began in 2014, according to the federal complaint. He began researching how to build improvised explosive devices about a year ago, began collecting the necessary items two to three weeks ago, and built the bomb in his home a week ago, the complaint states.
Investigators recovered a passport in his name with a handwritten message: "O America, die in your rage."
Ullah told investigators he was motivated in part by pro-ISIS Christmas attack propaganda circulated about a month ago online with an image of Santa Claus over Times Square, a law enforcement source told CNN.
Ullah did not pray at a mosque, according to the source, but prayed at his home in Brooklyn. The source also said several of Ullah's family members are not cooperating with authorities in the investigation at this time.
From March 2012 to March 2015, Ullah held a Taxi & Limousine Commission license, which had not been renewed, TLC spokesman Allan Fromberg said. It's unclear "whether he drove for any particular base, or whether he simply got the license but didn't drive at all," Fromberg said.
Ullah has no criminal record in his native Bangladesh, according to Sahely Ferdous, a Bangladesh police spokeswoman. Ferdous said Ullah last traveled to Bangladesh's capital Dhaka -- where he was born and raised -- in September, but police had no information on why he was there. The federal law enforcement source said Ullah's travel overseas was not significant for the planning of this attack.
Police in Bangladesh have been speaking with Ullah's wife in an effort to learn more about "how he was influenced and how he joined these activities," Ferdous said, adding that authorities went to the wife's residence in Dhaka to question her.
Ferdous said Ullah and his wife have a 1-year-old child, but she was not sure of the gender and had no information as to whether the wife was living in Dhaka or just visiting.
Ullah had at least two devices, a law enforcement source with knowledge of the investigation tells CNN.
Only one detonated -- a foot-long pipe that contained black powder, a battery, wiring, nails and screws. It was attached to Ullah with Velcro and zip ties. Investigators did not elaborate on the second device.
The suspect made the bomb last week at his apartment in Brooklyn, according to an official. New York Gov. Andrew Cuomo said it was an amateur, "effectively low-tech device."
The explosive chemical ignited, but the pipe itself did not explode, lessening its impact, Cuomo told CNN's Wolf Blitzer.
"Fortunately for us, the bomb partially detonated," he said. "He did detonate it, but it did not fully have the effect that he was hoping for."
CNN law enforcement analyst James Gagliano said the explosion could have been much worse.
"We really dodged a bullet yesterday," he said.
Five people were treated for minor injuries in area hospitals.
"Mount Sinai Health System received and treated five patients with minor injuries as a result of the explosion today at Port Authority; four at Mount Sinai West and one at Mount Sinai Queens," a statement from the hospital group said.
"All were in stable condition and were released today. We are working closely with officials in law enforcement in the wake of this event."
Ullah was apprehended by Port Authority police officers shortly after the blast. Four of the officers involved in the apprehension and arrest of the suspect have been named as Sean Gallagher, Drew Preston, John Collins and Anthony Manfredini.
"Today, four courageous Port Authority police officers risked their lives confronting an armed terrorist to protect others from harm," Port Authority Police Benevolent Association President Paul Nunziato said in a statement.
"I am so thankful there was no loss of life and I could not be prouder of our Port Authority police officers, their actions and dedication to their sworn duty."
Bobby Egbert, public information officer for the Port Authority Police Benevolent Association, said Manfredini was the first responding officer and he described a "smoke and debris-filled" scene.
Manfredini was on patrol in the area when he observed panicked people running out of the passageway. He then made a radio transmission, and three other officers immediately responded, Egbert said.
Officers first encountered the suspect lying on the floor in the passageway, Egbert said. Manfredini described the injuries to the suspect as what appeared to be shrapnel-type wounds.
The officers noticed the suspect reach for a cellphone, Egbert said. Because of their training, they knew that a cellphone can often be used as a detonator and treated the object as a secondary device. The officers struggled with the suspect, but were able to separate him from his cellphone, Egbert said.
All subways and trains are running as scheduled, except the passageway where the incident occurred. Some exits and transfers may be blocked so passengers may be affected.
Cuomo praised the courage of the authorities, first responders and the city's residents.
"I am deeply grateful to the first responders and security personnel who kept people safe after today's attack and brought the suspect into custody," he said.
"Despite this morning's terrible incident, New Yorkers went about their lives unafraid, undeterred and more united than ever before. We will not allow this to disrupt us."
He added that he was directing the World Trade Center spire to be lit in red, white and blue "as a symbol of our essential values of freedom and democracy."
Ullah's family released a statement through the Council on American-Islamic Relations saying they are heartbroken by the attack, but simultaneously "outraged" by the behavior of unspecified law enforcement officials during the investigation.
"Today, we have seen our children, as young as 4 years old, held out in the cold, detained as their parents were questioned," the statement said. "One teenage relative was pulled out of high school classes and interrogated without a lawyer, without his parents. These are not the actions that we expect from our justice system, and we hope to see better in the days and weeks to come."
US President Donald Trump said Monday that the attack bolstered the need for his preferred immigration policies, which the White House said would have prevented the suspect from entering the country.
Trump has called on Congress to end the diversity immigration lottery, which provides visas to people randomly chosen from countries where there is a low rate of immigration to the United States. He also has called to end chain migration, a term that describes immigration based on family connections.
"Today's terror suspect entered our country through extended-family chain migration, which is incompatible with national security," Trump said Monday.
L. Francis Cissna, the director of US Citizenship and Immigration Services, reiterated that call Tuesday.
"We need to be able to select the types of people that are coming here based on criteria that ensure their success. Criteria that ensure their ability to assimilate successfully in our country," Cissna said. "Random lotteries, extended family connections -- that's not the way we want to run an immigration system."