NEW YORK ― Police captured a suspect in what they called a “terror-related incident” in the transit system near Times Square during rush hour on Monday morning.

An improvised, low-tech pipe bomb device was affixed to his chest with Velcro and zip ties. The explosion, which occurred around 7:20 a.m. in the subway near Eighth Avenue and 42nd Street, immediately plunged the commuter hub into chaos.

Five people have been treated at two Mount Sinai hospitals for minor injuries related to the incident, the hospital said in a statement to HuffPost. They had all been released by about 5 p.m. local time.

Police identified the suspect as 27-year-old Akayed Ullah, who they said is a U.S. resident from the Bangladeshi city of Chittagong. According to investigators, Ullah, who had no criminal record, triggered the bomb intentionally and mentioned the self-described Islamic State after his arrest. He last visited Bangladesh on Sept. 8, authorities said.

Law enforcement officials told The Associated Press the suspect used matches, a lightbulb and a nine-volt battery to ignite a pipe stuffed with explosive material, but the blast wasn’t powerful enough to create harmful shrapnel. The man was injured himself, and had burns on his hands and abdomen, as well as lacerations, authorities said. He was being treated at Bellevue Hospital.

New York City Taxi and Limousine Commission/Handout/Reuters Akayed Ullah, a Bangladeshi man who police say attempted to detonate a homemade bomb in New York City on Monday, in a photo released by the city's Taxi and Limousine Commission.

The bomber reportedly told investigators he was inspired by terror attacks on Christmas markets in Europe, and chose the location in Manhattan due to its holiday-themed posters, The New York Times reported. He also said the bombing was in retaliation for U.S. airstrikes against ISIS targets in Syria and other locations.

Officials were preparing to charge Ullah in federal court in Manhattan, and the incident is being investigated by the Joint Terrorism Task Force, the Times reported.

Ullah lived with his father, mother and brother in an area of Brooklyn that has a large Bangladeshi community, his neighbors told the AP.

Alan Butrico, who owns the house next door to Ullah and a locksmith business two doors down, said: “It’s very weird … You never know who your neighbors are.”

The New York Taxi and Limousine Commission said Ullah had a black cab/limousine driver’s license from 2012 to 2015, after which it expired.

BREAKING PHOTO: The suspect in police custody following theexplosion at Port Authority Bus Terminal. pic.twitter.com/IwM98CSBRP — New York City Alerts (@NYCityAlerts) December 11, 2017

Police Commissioner James O’Neill called the explosion a “terror-related incident” during a mid-morning news conference. He declined to elaborate on Ullah’s statement, but called on citizens to come forward with information about the event and other concerning behavior.

“We are New Yorkers. We don’t live in fear,” O’Neill said at a briefing. “If you see something doesn’t look right, you have an obligation to come forward, call 911, flag down a cop, and give us a chance to investigate it.”

New York Gov. Andrew Cuomo (D) described the explosive as a “low-tech device” and said the plot was isolated to one individual.

"This is one of my nightmares, right, a terrorist attack in the subway system." @NYGovCuomo says Monday's attack was one in "a growing pattern," but says "we were on top of it." pic.twitter.com/hh999qdH7P — Spectrum News NY1 (@NY1) December 11, 2017

“This is one of my nightmares: a terror attack in the subway system. Luckily, the damage was minimal, but this was one in a growing pattern that we’re seeing develop,” Cuomo said on Spectrum News NY1 later Monday afternoon. “The good news is that we were on top of it. We have the greatest law enforcement force on the planet, in my opinion, and the reality was not as bad as the fear.”

Mayor Bill de Blasio, speaking at an earlier press conference alongside Cuomo, stressed that terrorists “yearn to attack New York City.”

“All we know of is one individual who, thank God, was unsuccessful in his aims,” he said.

President Donald Trump said in a statement that the attempted attack proved the relevance of his executive order restricting the entry of travelers from eight countries into the United States. He also said the attempt showed the need for restrictions to so-called chain migration, which allows people to sponsor visas of family members besides spouses and unmarried minor children.

“First and foremost, as I have been saying since I first announced my candidacy for President, America must fix its lax immigration system, which allows for too many dangerous, inadequately vetted people to access our country,” the president said.

The area where the explosion occurred is one of New York City’s busiest tourist and commuter zones. The Times Square-42nd Street/Port Authority station serves a dozen subway lines and a variety of local and regional bus lines.

The blast immediately sent the key transit hub into chaos. The A, C and E subway lines were evacuated, Sgt. Brendan Ryan told HuffPost, and the busy Port Authority bus terminal was cleared and temporarily shut down. Other trains bypassed Times Square and Port Authority stations.

Rosemary Usoh, 40, told HuffPost she was on the third floor of the bus terminal around 7:15 a.m. when at least a dozen police officers with automatic weapons shouted for people to evacuate the building immediately.

“They yelled at us to get out, that there was an explosion,” Usoh said. “I was nervous. There were a lot of people running.”

Alicja Wlodkowski, 51, told The New York Times that she was in a restaurant inside the bus terminal building when the explosion occurred.

“A woman fell, and nobody even stopped to help her because it was so crazy,” Wlodkowski said. “Then it all slowed down. I was standing and watching and scared.”

Video shows emergency crews responding to the Port Authority bus terminal on 42nd Street.

Snapchat video shows emergency crews outside Port Authority terminal after reports of possible explosion. pic.twitter.com/kMkDLfOgO0 — Ryan Wood (@RyanWoodDFW) December 11, 2017

The Port Authority said the subway entrance outside the building on Eighth Avenue was closed “due to police activity.” The bus terminal building was evacuated and shut down for several hours. It reopened later in the morning, but the Port Authority warned bus commuters to “contact their carrier for the most current information.”

Police closed surrounding streets.

Just police, MTA officials and reporters outside Port Authority right now pic.twitter.com/vQtZFhv4AQ — Hayley Miller (@hayleymiller01) December 11, 2017

This story has been updated with new details on the suspect and comments from Cuomo and Trump.