LINDEN, N.J. - (AP) -- An Afghan immigrant wanted 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, underwent surgery for a gunshot wound to the leg, and two officers were wounded but were not critically hurt in the shootout that followed a weekend of fear and dread across New York and beyond.
The arrest came just hours after police issued a bulletin and photo of Rahami, a naturalized U.S. citizen from Afghanistan who lived with his Muslim family in an apartment in Elizabeth, New Jersey, over a fried-chicken restaurant owned by his father.
U.S. Attorney Preet Bharara, chief federal prosecutor in New York, said New Jersey officials will probably bring charges against Rahami in the police officers' shooting while federal authorities weigh charges of their own.
"We have every reason to believe this was an act of terror," New York Mayor Bill de Blasio said after Rahami's capture.
On Saturday night, a shrapnel-packed pressure-cooker bomb similar to those used in the Boston Marathon attack exploded in New York's Chelsea section, wounding 29 people, none seriously. An unexploded pressure-cooker bomb was found blocks away.
Earlier that day, a pipe bomb blew up in Seaside Park, New Jersey, before a charity race to benefit Marines. No one was injured.
Then on Sunday night, five explosive devices were discovered in a trash can at an Elizabeth train station. Investigators said they are still gathering evidence and have not publicly tied Rahami to those bombs.
With Rahami's arrest, officials said they have no indication there are more bombs or suspects to find, though they cautioned that they are still working to understand Rahami's connections. His motive remains unclear, New York Police Commissioner James O'Neill said.
William Sweeney Jr., the FBI's assistant director in New York, said there are no indications Rahami was on law enforcement's radar at the time of the bombings.
As for how investigators zeroed in on him as a suspect, three law enforcement officials said the clues included a fingerprint lifted from one of the New York sites and "clear as day" surveillance video from the bombing scene that helped identify Rahami. The officials spoke to the Associated Press on condition of anonymity because they were not authorized to discuss the case.
Five people were pulled over Sunday night in a vehicle associated with Rahami but were questioned and released, Sweeney said, declining to say whether they might later face charges. The law enforcement officials said at least one of Rahami's relatives was in the car, which appeared headed toward Kennedy Airport in New York after coming from New Jersey.
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 gun battle that spilled into the street, police Capt. James Sarnicki said.
Peter Bilinskas was standing by his desk at his Linden bowling-supply shop when he heard what sounded like gunfire and saw a man walking down the street with a gun in his hand.
As a police car pulled up at the traffic light in front of the shop, the man fired about six shots at the cruiser, then continued down the street with police following him, Bilinskas said.
As the East Coast was rattled by the bombings, a man who authorities say referred to Allah wounded nine people in a stabbing rampage at a Minnesota mall Saturday before being shot to death by an off-duty police officer. Authorities are investigating it as a possible terrorist attack but have not drawn any connection between the bloodshed there and the bombings.
The Council on American-Islamic Relations, a national Muslim advocacy group, welcomed Rahami's arrest. The organization and the Afghan Embassy in Washington condemned the bombings.
Around the time Rahami was captured, President Barack Obama was in New York on a previously scheduled visit for a meeting of the U.N. General Assembly. He called on Americans to show the world "we will never give in to fear."
Rahami lived with his family on a busy street a few miles from the Newark airport. An AP reporter went to the building that houses the family's restaurant and home, but it was cordoned off.
Rahami's father, Mohammad, and two of Rahami's brothers sued the city of Elizabeth in 2011 after it passed an ordinance requiring their restaurant, First American Fried Chicken, 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 Rahami 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, 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.
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.
Luck and some scavengers played a role in the investigation: Two homeless men grabbed a backpack left on a trash can near the Elizabeth train station, only to discover it contained several apparent pipe bombs. They quickly reported the find to police, said Elizabeth Mayor Christian Bollwage.
On Saturday, two men walking down a street in New York saw a rolling bag on a sidewalk, opened it, discarded the pressure cooker they found inside and walked off with the bag, police said. Later that evening, after the blast in Chelsea, state troopers found the unexploded device.
Pearson reported from New York. Associated Press writers Michael Balsamo and Jennifer Peltz in New York; Dake Kang and Michael Catalini in Elizabeth; and Eric Tucker, Alicia A. Caldwell and Kevin Freking in Washington contributed to this report.