NEW YORK (AP) — An Afghan immigrant wanted for questioning in the bombings that rocked a New York City neighborhood and a New Jersey shore town was taken into custody Monday after a shootout with police in New Jersey, a law enforcement official told The Associated Press.

WABC-TV footage showed a man believed to be 28-year-old Ahmad Khan Rahami being loaded into an ambulance on a stretcher in Linden, New Jersey. He appeared to be conscious and looking around.

Video shows bombing suspect Ahmad Rahami in custody in Linden, New Jersey. pic.twitter.com/NrVJCPNAkC — Eyewitness News (@ABC7NY) September 19, 2016

The law enforcement official, who was not authorized to discuss the investigation and spoke on condition of anonymity, said two officers were shot in the gun battle.

The arrest came just hours after police issued a bulletin and photo of Rahami, a naturalized U.S. citizen from Afghanistan with an address in Elizabeth, New Jersey.

Authorities said the blasts were looking increasingly like an act of terrorism with a foreign connection.

Police did not disclose how they zeroed in on Rahami but were known to be poring over surveillance video. At the same time, five people who were pulled over in a vehicle Sunday night were being questioned by the FBI, officials said.

The shootout came after a weekend of fear and dread in New York and New Jersey.

#Breaking: Photo shows take down of NY, NJ bomb suspect in Linden, NJ Ahmad Rahami https://t.co/GWW3Q2XcAz? pic.twitter.com/1tFnXQw7bP — NBC10 Philadelphia (@NBCPhiladelphia) September 19, 2016

In addition to the blast that injured 29 people in Manhattan’s Chelsea neighborhood on Saturday, an unexploded pressure cooker bomb was found blocks away, and a pipe bomb exploded in a New Jersey shore town before a charity race. No one was injured there. On Sunday, five explosive devices were discovered in a trash can at an Elizabeth train station.

Also on Saturday, a man who authorities say referred to Allah wounded nine people in a stabbing rampage at a Minnesota mall before being shot to death by an off-duty police officer. The Islamic State group claimed responsibility.

Authorities have not drawn any connection between the violence in Minnesota and the bombings in the New York area.

Citing the FBI, New Jersey State Police said Monday that the bombings in Chelsea and the New Jersey shore town Seaside Park were connected.

New York Gov. Andrew Cuomo said as investigators gathered information, they learned there were “certain commonalities among the bombs,” leading authorities to believe “that there was a common group behind the bombs.”

Before Rahami’s capture, Cuomo said investigators have no reason to believe there are further threats, but the public should “be on constant guard.”

Early Monday, FBI agents swarmed an apartment above a fried chicken restaurant in Elizabeth that is tied to Rahami. The Rahami family lives in the apartment.

The restaurant, First American Fried Chicken, is owned by Rahami’s father and has also employed some of his brothers, Elizabeth Mayor Christian Bollwage said.

He said Rahami’s father and two brothers sued the city after it passed an ordinance requiring the restaurant to close early because of complaints from neighbors about it being a late-night nuisance.

Ryan McCann, of Elizabeth, said that he often ate at the restaurant and recently began seeing Rahami working there more.

“He’s always in there. He’s a very friendly guy, that’s what’s so scary. It’s hard when it’s home,” McCann said.

In the immediate aftermath of the New York bombing, de New York Mayor Bill de Blasio and Cuomo were careful to say there was no evidence of a link to international terrorism. Both said Monday that appeared to be changing.

“The more we learn with each passing hour is it looks more like terrorism,” de Blasio said in an interview on NY1 News. Cuomo said on MSNBC: “Today’s information suggests it may be foreign-related, but we’ll see where it goes.”

On Sunday night, FBI agents in Brooklyn stopped “a vehicle of interest” in the investigation of the Manhattan explosion, according to FBI spokeswoman Kelly Langmesser.

She wouldn’t provide further details, but a government official and a law enforcement official who were briefed on the investigation told The Associated Press that five people in the car were being questioned at an FBI building in Manhattan.

The officials spoke on condition of anonymity because they were not authorized to talk about the investigation.

On Sunday, a federal law enforcement official said the Chelsea bomb contained a residue of Tannerite, an explosive often used for target practice that can be picked up in many sporting goods stores.

Cellphones were discovered at the site of both the New York and New Jersey bombings, but no Tannerite residue was identified in the New Jersey bomb remnants, in which a black powder was detected, said the official, who wasn’t authorized to comment on the investigation and spoke to the AP on condition of anonymity.

The pipe bomb that exploded Saturday in Seaside Park went off before a charity 5K race to benefit Marines and sailors. The race was canceled.

One of the five devices found at the Elizabeth train station exploded while a bomb squad robot tried to disarm it. No one was hurt.