This undated photo provided by the New York City Taxi and Limousine Commission shows Akayed Ullah, the suspect in the explosion near New York's Times Square on Monday, Dec. 11, 2017. Ullah is suspected of strapping a pipe bomb to his body and setting off the crude device in a passageway under 42nd Street between Seventh and Eighth Avenues, injuring himself and a few others. (New York City Taxi and Limousine Commission via AP) This undated photo provided by the New York City Taxi and Limousine Commission shows Akayed Ullah, the suspect in the explosion near New York's Times Square on Monday, Dec. 11, 2017. Ullah is suspected of strapping a pipe bomb to his body and setting off the crude device in a passageway under 42nd Street between Seventh and Eighth Avenues, injuring himself and a few others. (New York City Taxi and Limousine Commission via AP)

NEW YORK (AP) — A would-be suicide bomber inspired by Islamic State extremists strapped on a crude pipe bomb, slipped unnoticed into the nation’s busiest subway system and set the device off at rush hour Monday in a scenario that New York has dreaded for years, authorities said.

In the end, the only serious wounds were to the suspect identified as Akayed Ullah, a 27-year-old Bangladeshi immigrant and former cab driver. But the attack sent terrified commuters fleeing through a smoky passageway, and three people suffered headaches and ringing ears from the first bomb blast in the subway in more than two decades.

“This was an attempted terrorist attack,” Democratic Mayor Bill de Blasio said. “Thank God the perpetrator did not achieve his ultimate goals.”

The suspect had looked as Islamic State propaganda online and told investigators he acted alone in retaliation for U.S. military aggression, law enforcement officials said.

In Washington, President Donald Trump said the explosion highlighted the need to change immigration policies, including the type of family-based visa Ullah obtained to come to the U.S. in 2011. Such visas are “incompatible with national security,” the Republican president said in a statement.

ADVERTISEMENT

“America must fix its lax immigration system, which allows far too many dangerous, inadequately vetted people to access our country,” said Trump, who campaigned on cracking down on immigration.

The attack near Times Square came less than two months after eight people died near the World Trade Center in a truck attack authorities said was carried out by an Uzbek immigrant who admired the Islamic State group.

Law enforcement officials said Ullah was inspired by IS but apparently did not have any direct contact with the group. Gov. Andrew Cuomo said there was no evidence, so far, of other bombs or a larger plot. He said officials were exploring whether Ullah had been on authorities’ radar, but there was no indication yet that he was.

Cuomo said there was reason to believe the attacker looked at bomb-making instructions online.

Investigators described the bomb as a low-tech explosive device attached to Ullah with “Velcro and plastic ties.” It was ignited with a Christmas light, matches and a nine-volt battery. The short pipe was packed with explosive powder but did not work as intended. It was not powerful enough to turn the pipe into deadly shrapnel, the officials said.

ADVERTISEMENT

Investigators said the suspect was seen on surveillance footage putting the circuits together with his hands and igniting the bomb.

Some of the bomb-making materials may have been bought commercially. The pipe may have been obtained from his job where he worked as an electrician, one official said.

Authorities were searching Ullah’s Brooklyn home and a nearby rented space, interviewing witnesses and relatives, reviewing his subway fare card and looking for surveillance footage that might show his movements in the moments before the 7:20 a.m. attack.

Security cameras captured the attacker walking casually through a crowded passageway under 42nd Street between Seventh and Eighth avenues when the bomb went off amid a plume of white smoke, which cleared to show the man sprawled on the ground and commuters scattering.

“All we could hear was the chaos,” said Elrana Peralta, a Greyhound customer-service worker who was working at the Port Authority bus terminal near the blast, though she did not hear it. Instead, she heard people yelling, “Get out! Get out! Get out!”

Port Authority police said officers found the man injured on the ground, with wires protruding from his jacket to his pants and the device strapped to his torso under his coat. They said he was reaching for a cellphone and they grabbed his hands.

A photo published by the New York Post showed a bearded man crumpled on the ground with his shirt apparently blown off and black soot covering his bare midriff.

Law enforcement officials said the suspect was speaking with investigators from the hospital bed where he was being treated for burns to his hands and abdomen.

He was “all over the place” on the question of motive, but indicated he wanted to avenge U.S. aggression against the Islamic State, one official said.

The officials spoke to The Associated Press on condition of anonymity because they were not authorized to speak publicly about the blast.

Ullah came to the U.S. on an F-4 visa, available for those with family in the U.S. who are citizens, the Department of Homeland Security said. Trump’s administration has called for a “merit-based” immigration system that would limit family-based green cards to spouses and minor children. A White House spokeswoman said Monday that the proposed policy would have kept Ullah out of the U.S.

He had been licensed to drive a livery cab between 2012 and 2015, but the license was allowed to lapse, according to law enforcement officials and New York City’s Taxi and Limousine Commission. He had been in two car accidents during his time driving, one law enforcement official said.

Ullah lived with his father, mother and brother in a Brooklyn neighborhood with a large Bangladeshi community, residents said. The family’s red, two-story brick home is just off a shopping strip.

A statement on behalf of the family sent by the New York Chapter of the Council on American-Islamic Relations said they were “deeply saddened” by the attack but also “outraged by the way we have been targeted by law enforcement, including a teenage relative of the suspect who was pulled from class and questioned in his school without a parent guardian or attorney.”

News of Ullah’s arrest stunned Alan Butrico, who owns the house next door and a locksmith business two doors down.

“It’s very weird,” Butrico said. “You never know who your neighbors are.”

The last bomb to go off in the subway system was believed to be in December 1994, when an explosive made from mayonnaise jars and batteries wounded 48 people in a car in lower Manhattan.

The Times Square subway station is the city’s busiest, with 64 million riders passing through every year. The subway system as a whole carried over 1.7 billion people last year.

Monday’s explosion triggered a massive emergency response both above and below ground, halting what would ordinarily be a bustling rush hour at the “Crossroads of the World.” But streets quickly began returning to normal.

“This is one of my nightmares, right: a terrorist attack in the subway system,” Cuomo, a Democrat, later told cable channel NY1.

“The good news is: We were on top of it,” he said, and “the reality was not as bad as the fear.”

___

Associated Press writers Tom Hays, Jennifer Peltz, Jake Pearson, Kiley Armstrong, Larry Neumeister and David James Jeans in New York, Michael Balsamo in Los Angeles, Matt Pennington in Washington, D.C., and AP researcher Rhonda Shafner in New York contributed to this report.

___

Follow Colleen Long on Twitter at: www.twitter.com/ctlong1 .