A New Jersey police officer responding to a call about a hoodied vagrant curled up asleep in a bar doorway roused him and quickly recognized the bearded face of perhaps the most wanted man in America.
Ahmad Khan Rahami — identified in an FBI bulletin just hours earlier as a man wanted in the weekend bombings in New York City and New Jersey — pulled a gun, shot the officer and triggered a running gun battle in the street that ended with Rahami wounded and in custody Monday, authorities said.
A bloodied Rahami was loaded into the back of an ambulance, just 50 hours after the first blast that started it all.
Rahami, 28, a naturalized U.S. citizen from Afghanistan who lived with his Muslim family in Elizabeth, New Jersey, underwent surgery for a gunshot wound to the leg as authorities began drawing up charges in a case that spread fear across the New York area and revived anxiety about homegrown terrorism.
New York Mayor Bill de Blasio said officials have every reason to believe the series of bombings "was an act of terror," though investigators said Rahami's exact motive isn't yet clear.
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 investigating.
Still, after a whirlwind investigation that put Rahami in custody in just two days' time, "I'm a lot happier today than I was yesterday," New York City Police Commissioner James O'Neill said.
The probe started when a pipe bomb blew up Saturday morning in Seaside Park, New Jersey, before a charity race to benefit Marines. No one was injured.
Then a shrapnel-packed pressure-cooker bomb similar to those used in the Boston Marathon attack exploded Saturday night in New York's Chelsea section, wounding 29 people, none seriously. An unexploded pressure-cooker bomb was found blocks away.
Late 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 devices.
Late Monday, a hospitalized Rahami was charged in New Jersey with five counts of attempted murder of police officers in connection with the shootout and was held on $5.2 million bail. Federal prosecutors said they were still weighing charges over the bombings.
It wasn't known if Rahami had an attorney. Messages left for family members were not immediately returned.
Rahami lived with his family above their fried-chicken restaurant in Elizabeth, and his relatives have clashed with the city over closing times and noise complaints they said were tinged with anti-Muslim sentiment. A childhood friend, Flee Jones, said Rahami had become more religious after returning from a trip to Afghanistan several years ago. Still, some of the family restaurant's customers said that while Rahami was devout, he was more likely to talk about his interest in cars than to mention faith.
William Sweeney Jr., the FBI's assistant director in New York, said there were no indications Rahami was on law enforcement's radar at the time of the bombings.
Authorities zeroed in on him as the potential bomber after a fingerprint and DNA obtained from one of the New York sites and "clear as day" surveillance video from the bombing scene helped identify him, according to three law enforcement officials who spoke 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 a bar owner reported someone asleep in his doorway.
Jack Mazza, co-manager of nearby V.C.M.R. Truck Services, said the bar owner came over exclaiming about the sleeping man, and Mazza walked over to see a man curled up with a sweatshirt hood pulled over his head in the rain.
"He looked like a bum," Mazza said.
After an officer arrived and recognized Rahami, Rahami shot the officer, who was saved by his bulletproof vest, authorities said. More officers joined in a gun battle that spilled into the street.
Another police officer was grazed by a bullet. Authorities said neither officers' injuries were life-threatening.
Peter Bilinskas said he 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."
Republican presidential candidate Donald Trump called for using "whatever lawful methods are available" to get information from Rahami, mocked the fact that he would receive quality medical care and legal representation, and called for profiling foreigners who look like they could have connections to terrorism or certain Mideastern countries.
Democratic hopeful Hillary Clinton said her rival's anti-Muslim rhetoric gives "aid and comfort" to Islamic terrorists by helping them recruit fighters.
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 Ahmad 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.