A pipe bomb strapped to a man went off in the New York City subway near Times Square on Monday, injuring him and three other people at the height of the morning rush hour, law enforcement officials said.

"Let's be clear, this was an attempted terrorist attack," New York City Mayor Bill de Blasio said.

Police said the explosion happened in an underground passageway under 42nd Street between 7th and 8th Avenues, with first responders notified around 7:20 a.m. ET. The blast filled the passageway, crowded with throngs of Monday morning commuters, with smoke.

Officials said a man transported an "improvised, low-tech" explosive device attached to his body and set it off. He suffered injuries, as did three people nearby.

EMS removed perpetrator to Bellevue Hospital. 3 people in proximity to the explosion removed themselves, all have minor injuries consistent with being in area of an explosion -<a href="https://twitter.com/hashtag/FDNY?src=hash&ref_src=twsrc%5Etfw">#FDNY</a> Commissioner Nigro gives update on explosion at Port Authority —@FDNY

James O'Neill, NYPD commissioner, identified the suspect as Akayed Ullah, 27. He suffered lacerations and was transported to Bellevue Hospital.

The device was based on a pipe bomb and affixed with Velcro and zip ties.

'It was fairly orderly'

This undated photo provided by the New York City Taxi and Limousine Commission shows Akayed Ullah, the suspect in Monday's incident. (New York City Taxi and Limousine Commission via AP) Kelly said Ullah did make statements after the attempt, but would not specify any political motives or any affiliations or sympathies with militant groups.

Officials told The Associated Press that Ullah lives in Brooklyn and came to the U.S. from Bangladesh about seven years ago on an F-4 visa, a preferential visa available for those with family in the U.S. who are citizens or permanent residents. The officials spoke to AP on condition of anonymity because they were not authorized to speak publicly about the blast.

White House spokesperson Sarah Huckabee Sanders said on Monday afternoon that the explosion shows the need for "immigration reform" and that Congress should work with the president, stressing the need to "protect our borders." Sanders also called for a "merit-based" immigration system, although it's not clear if that would have disqualified Ullah.

Ullah had been licensed to drive a livery cab between 2012 and 2015, according to the NYC Taxi and Limousine Commission, but let the licence lapse.

Ullah lived with his father, mother and brother in a residential area of Brooklyn with a large Bangladeshi community, neighbours said.

Alan Butrico owns the house next door and a locksmith business two doors down.

"It's very weird," he said. "You never know who your neighbours are."

Police stand guard inside the Port Authority Bus Terminal following an explosion near Times Square on Monday. (Andres Kudacki/Associated Press)

The Bangladesh Embassy in Washington condemned the attack. The deputy chief of mission, Mahbub Hassan Saleh, said the embassy had not received any information from authorities about the suspect.

'I was freaking out'

The incident was captured on transit system video, which investigators will analyze. They said they had not uncovered any additional plans or activities related to the bombing.

Elrana Peralta, a customer service worker for Greyhound, said she works in the Port Authority terminal complex near where the blast happened, but did not hear the explosion.

"All we could hear was the chaos," she said. "We could hear people yelling, 'Get out! Get out! Get out!"'

John Miles, 28, from Vermont, was waiting for a bus to Massachusetts. He also did not hear the blast, but saw police react.

"I didn't know what was going on. Officers were running around. I was freaking out," he said. There was an announcement that people should take their bags and leave. "They didn't incite panic. It was fairly orderly."

De Blasio also said there were no credible, specific threats to the city in general.

Gov. Andrew Cuomo praised law enforcement agencies and expressed gratitude the incident was not as life threatening as it could have been, given the time of the incident at the busy transportation node.

The Port Authority bus terminal was closed after the incident, but reopened about two hours later. Subway service was gradually being restored, and officials didn't anticipate any disruptions related to the incident for the late afternoon commute.