Follow CBSMIAMI.COM: Facebook | Twitter

MANHATTAN (CBSMiami/CNN) — The man accused of setting off an explosive in a Manhattan subway tunnel posted on Facebook earlier in the day, “Trump you failed to protect your nation,” according to a criminal complaint.

READ MORE: South Floridians Brave Hot Weather To Get Vaccinated

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.

Investigators are piecing together what led up to the attack in which authorities say Akayed Ullah, a 27-year-old Bangladeshi man, detonated his device during the busy morning commute.

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 location

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 says.

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.

The suspect

The suspect has been named as 27-year-old Akayed Ullah, a Bangladeshi who has been living in the US 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 US, 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 currently hospitalized 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 that 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 that 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 (TLC) 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 the capital Dhaka to question her.

Ferdous said Ullah and his wife have a one-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.

The bomb

Ullah had at least two devices, a law enforcement source with knowledge of the investigation tells CNN.

READ MORE: 'Health In The Hood' Initiative, Food Distribution Like No Other

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.

Opinion: Amateur terrorists can kill, too

The victims

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.”

The response

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, told CNN that 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 told CNN.

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 cell phone, Egbert said. Because of their training, they knew that a cell phone 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 cell phone, 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.

Gov. 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 an attempted terrorist attack in New York bolsters the need for his preferred immigration policies, which the White House says would have prevented the suspect from entering the country.

MORE NEWS: Famous Local Chef Antonio Bachour Pays It Forward Raising Money For Ronald McDonald House

(©2017 CBS Broadcasting Inc. All Rights Reserved. CNN contributed to this report.)