An attempted suicide bomber who set off a rush-hour explosion at the nation's busiest bus terminal is a Bangladeshi national living in Brooklyn who was inspired by ISIS, law enforcement officials said.

The suspect in Monday morning's blast at Port Authority in midtown Manhattan was identified as Akayed Ullah, 27. Ullah strapped a pipe bomb to his body with Velcro and zip ties, and it detonated in a subway corridor, police said.

Ullah was taken to a hospital to be treated for his injuries. He was "all over the place" about his motive but indicated he wanted to avenge what he portrayed as U.S. aggression against the Islamic State group, a law enforcement official told the Associated Press.

He was charged with criminal possession of a weapon, support of an act of terrorism and making terrorist threats, the NYPD said Tuesday.

What do we know about the suspect?

Ullah lived in Brooklyn after he entered the U.S. in 2011 from Bangladesh on a chain migration visa, Department of Homeland Security Press Secretary Tyler Houlton said in a statement.

DHS said Ullah came to the U.S. on an F43 visa, a preferential visa available for those with family in the U.S. who are citizens. He was considered a "Lawful Permanent Resident from Bangladesh," Houlton told Fox News.

Law enforcement officials said Ullah was inspired by ISIS but didn't appear to have direct contact with the group and likely acted alone.

The morning of the attack, Ullah posted on Facebook, "Trump you failed to protect your nation," according to a criminal complaint. A passport found in his home included handwritten notes, the complaint said, including, "O America, die in your rage."

Ullah was a licensed cab driver from March 2012 to March 2015, the New York City Taxi and Limousine Commission confirmed to Fox News. His TLC For-Hire Vehicle Driver's License was not renewed after 2015.

The TLC spokesperson did not confirm "whether he drove for any particular base, or whether he simply got the license but didn't drive at all." He did say Ullah was not licensed to drive a yellow taxi.

An Uber spokeswoman confirmed to Fox News that the ride-sharing company has no record of Ullah being "connected to the Uber platform." Lyft also does not "have any records" that Ullah worked for it, a spokesperson told Fox News.

Ullah’s family was “deeply saddened” by the attack but also “outraged” by the way they were allegedly treated by law enforcement officials, they said in a statement. A teenage relative of Ullah was pulled out of class and questioned without a parent, guardian or lawyer, the family alleged.

What else do we know about the attack?

The suspect allegedly packed a metal pipe bomb and battery pack into the right side of his jacket, according to a criminal complaint filed in the Southern District of New York. The complaint said Ullah made the bomb at his Brooklyn home, and investigators found other bomb-making materials in the residence.

The device was an “effectively low-tech device,” New York Gov. Andrew Cuomo said Monday. Officials said they are investigating whether the suspect detonated the bomb intentionally or if it went off prematurely.

The explosion occurred just before 7:30 a.m. near 42nd Street between Seventh and Eighth Avenues, law enforcement officials said. The explosion triggered a massive emergency response by police and fire both above and below ground, tangling subway and bus service at Port Authority.

New York City Mayor Bill de Blasio said the explosion was an “attempted terrorist attack.”

“At this point in time,” the only suspect is the one man already in custody, de Blasio said Monday morning, adding that the city is lucky the suspect didn’t achieve his intended goals.

At least four people, not including the suspect, were injured in the explosion, an NYPD spokeswoman confirmed to Fox News Monday afternoon.

Fox News' Jake Gibson, Rick Leventhal, John Roberts and The Associated Press contributed to this report.