

NEW YORK — A Bangladeshi immigrant who police say was inspired by the Islamic State set off a pipe bomb strapped to his body during Monday’s morning rush hour, injuring himself and four other people, and disrupting the commutes of hundreds of thousands of workers.
The blast echoed through the subway tunnels just off Times Square, in one of Manhattan’s busiest transportation corridors, and filled parts of the Port Authority Bus Terminal with smoke. Commuters fled into the streets to escape what authorities quickly concluded was an act of terror.
The attack highlighted the potential vulnerabilities of the nation’s subway systems and prompted a renewed call from President Trump for tighter immigration policies.
A suspect, identified by the police as Akayed Ullah, 27, of Brooklyn, was in police custody. Authorities said Ullah, who entered the country about seven years ago, was inspired by the Islamic State but had no contact with the militant group. He appeared to have acted alone.
Ullah suffered burns to his hands and abdomen, and was in serious condition at Bellevue Hospital Center, according to Daniel A. Nigro, the New York fire commissioner. Four other people had minor injuries including headaches and ringing in the ears.
Several law enforcement officials said Ullah told investigators he chose the location because of its Christmas-themed posters, recalling recent strikes in Europe against Christmas markets. He also said he set off the bomb in retaliation for US airstrikes on Islamic State targets in Syria and elsewhere, they said.
Trump said after the attack that the nation ‘‘must fix its lax immigration system, which allows far too many dangerous, inadequately vetted people’’ into the country.
He pointed to his controversial travel ban as an example of the kind of policy that should be put in place. He also called on Congress to end ‘‘chain migration,’’ in which family members are permitted to join relatives who have immigrated.
Attorney General Jeff Sessions said the assault demonstrated ‘‘failed immigration policies.’’
He said immigrant relatives of US citizens shouldn’t get priority ahead of ‘‘someone who is high-skilled, well educated, has learned English, and is likely to assimilate and flourish here.’’
Ullah came to the United States in 2011 on an F-4 visa, a preferential visa available for those with family members who are US citizens, a spokesman for the Department of Homeland Security said.
He had been licensed to drive a livery cab between 2012 and 2015, but the license was allowed to lapse, officials said.
Monday’s attack, at 7:20 a.m., occurred in a long pedestrian walkway connecting the Eighth Avenue, Seventh Avenue, and Broadway subway lines.
Walking among the commuters trudging beneath Times Square was a man in a hooded sweatshirt. Then a deafening boom and smoke.
Ullah had attached the pipe bomb to himself with a “combination of Velcro and zip ties,’’ said James P. O’Neill, the police commissioner. The secure fastening may have indicated that Ullah entered the subway intending to carry out a suicide bombing.
Ullah is believed to have acted alone, Mayor Bill de Blasio said at a news conference on Eighth Avenue, just outside the Port Authority. He added that no other devices had been found, but de Blasio spoke as the investigation was still in its preliminary stages.
“Our lives revolve around the subway,’’ the mayor said. “The choice of New York is always for a reason, because we are a beacon to the world. And we actually show that a society of many faiths and many backgrounds can work.’’
“The terrorists want to undermine that,’’ the mayor added. “They yearn to attack New York City.’’
Christina Bethea was in the underground walkway, headed to her job as a security guard, when the explosion nearly knocked her over, sending a haze of smoke into the corridor packed with commuters. She did not see where it came from, she said.
“As soon as we heard ‘boom!’ we began to run,’’ she said. An hour after the attack, she stood outside the Port Authority, calling her mother and father in North Carolina to tell them she was OK. “I feel good,’’ Bethea said. “I am alive!’’
Upstairs in the Port Authority Bus Terminal, Alicja Wlodkowski was sitting in a restaurant when she saw people run by.
“A woman fell, and nobody even stopped to help her because it was so crazy,’’ said Wlodkowski, 51, of Stroudsburg, Pa. “I was standing and watching and scared. I didn’t want to go after the people. I didn’t want to go anywhere.’’
The attack came less than two months after eight people died near the World Trade Center in a truck attack authorities said was also inspired by the Islamic State.
Authorities searched Ullah’s residence on Ocean Parkway, using a federal warrant, and also reviewed surveillance video. It was unclear whether Ullah was known to any police agency.
Federal and local law enforcement officials indicated that Ullah would be prosecuted in federal court in Manhattan by the office of the acting US attorney for the Southern District of New York, Joon H. Kim.
The attack is being investigated by the Joint Terrorism Task Force, which is made up largely of FBI agents and New York detectives, along with investigators from a score of other federal, state, and local law enforcement agencies.
The attack roiled commutes across the region. All subway lines were directed to skip 42nd Street stops, according to the Metropolitan Transportation Authority. By afternoon, only the A, C, and E lines were still skipping the stop. The Port Authority was evacuated for several hours; it reopened around 10:30 a.m.
All morning, thwarted travelers spilled into the streets of Times Square, towing suitcases in bewildered silence. They gathered at police cordons stretched across 42nd Street, as emergency vehicles arrived at the scene every few minutes.
John Frank, 54, was standing on 42nd Street by the Port Authority exit when he felt tremors through the pavement. “That’s how strong it was,’’ he said. Everyone began to run.’’
“In New York City, we are vulnerable to a lot of things,’’ he said. “These incidents are happening too frequently.’’
Material from the Associated Press was used in this report.