LINDEN, N.J. (AP) - An Afghan immigrant wanted for questioning in the bombings that rocked a New York City neighborhood and a New Jersey shore town was captured Monday after being wounded in a gun battle with police that erupted when he was discovered sleeping in a bar doorway, authorities said.
Ahmad Khan Rahami, 28, appeared conscious, his upper right arm bandaged and bloodied, as he was loaded into an ambulance in Linden. Authorities said he underwent surgery for a gunshot wound to the leg.
Two officers were wounded in the shootout but were not believed to be seriously hurt, authorities said.
The arrest just hours after police issued a bulletin and photo of Rahami, a naturalized U.S. citizen from Afghanistan who lived with Muslim family in an apartment in Elizabeth, New Jersey, over a fried-chicken restaurant owned by his father.
"We have every reason to believe this was an act of terror," New York Mayor Bill de Blasio said after the arrest, which came less than 36 hours after a shrapnel-packed pressure-cooker bomb similar to those used in the Boston Marathon bombing injured 29 people in New York's Chelsea section, none seriously.
A law enforcement official said investigators regard Rahami as the "main guy" in the two explosions but plan to look into whether any others had a role.
The official, who was not authorized to discuss the investigation and spoke on condition of anonymity, said Rahami was not believed to be on federal terror watch lists at the time of the blasts.
Linden Mayor Derek Armstead said the break in the case came late Monday morning, when the owner of a bar reported someone asleep in his doorway. A police officer went to investigate and recognized the man as Rahami, police and the mayor said.
Rahami pulled a gun and shot the officer -- who was wearing a bulletproof vest -- in the torso, and more officers joined in a running gun battle along the street and brought Rahami down, police Capt. James Sarnicki said.
Police did not disclose how they zeroed in on Rahami as a person of interest in the bombings but were known to be poring over surveillance video and examining bomb fragments and components for evidence.
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.
In addition to the blast in Chelsea on Saturday night, 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 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. But authorities have not drawn any connection between the bloodshed there and the bombings.
Citing the FBI, New Jersey State Police said Monday that the bombs 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."
Around the time Rahami was taken into custody, President Barack Obama was in New York on a previously scheduled visit for a meeting of the U.N. General Assembly, and said it was "extremely fortunate" nobody was killed in the bombings.
He called on Americans to show the world "we will never give in to fear."
"We all have a role to play as citizens to make sure we don't succumb to that fear. And there's no better example of that than the people of New York and New Jersey," the president said. "Folks around here, they don't get scared."
Rahami lived with his family on a busy street a few miles from the Newark airport. Early Monday, FBI agents swarmed the apartment.
Elizabeth Mayor Christian Bollwage said Rahami's father, Mohammad, and two of Rahami's brothers sued the city in 2011 after it passed an ordinance requiring the First American Fried Chicken restaurant to close early because of complaints from neighbors that it was a late-night nuisance.
The Rahamis charged in the lawsuit that they were targeted by neighbors because they are Muslims. The lawsuit was terminated in 2012 after Mohammad Ruhami pleaded guilty to blocking police from enforcing the restrictions on the restaurant.
Ryan McCann, of Elizabeth, said that he often ate at the restaurant and recently began seeing the younger 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.
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.