The man suspected of planting bombs in New York and New Jersey provided investigators with a wealth of clues that led to his arrest some 50 hours after the first explosion, officials have said.
Ahmad Khan Rahami's fingerprints and DNA were found at the scene of the Manhattan bombing, according to three law enforcement officials.
His uncovered face was clearly captured by surveillance cameras near the spot of the blast, and electronic toll records showed that a car to which he had access was driven from New Jersey to Manhattan and back to New Jersey on the day of the bombing, according to the officials.
Those and other clues spurred officials to publicise his name and photo on Monday morning, asking for help finding Rahami, 28, a US citizen born in Afghanistan, who lives with his Muslim family in Elizabeth, New Jersey.
Hours later, a police officer in Linden, New Jersey, recognised Rahami after finding him sleeping in a doorway, prompting a confrontation and shootout that led to his capture.
"A lot of technology involved in this, but a lot of good, old-fashioned police work, too," said New York police commissioner James O'Neill. He said investigators would "make sure that we get to the bottom of who's involved and why".
After surgery for a gunshot wound to his leg, Rahami was being held on $5.2m bail, charged with five counts of attempted murder of police officers. Federal prosecutors said they were still weighing up charges over the bombings. Rahami remains in hospital.
With Rahami's arrest, officials said they had no other suspects at large, but cautioned that they were still investigating.
The bombing spread fear across the New York area and revived anxiety about homegrown terrorism across the country.
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 shopping centre on Saturday before being shot dead by an off-duty police officer. Authorities are investigating the stabbings as a possible terrorist attack but have not drawn any connection between the bloodshed there and the bombings.
William Sweeney Jr, the FBI's assistant director in New York, said there was no indication so far that the bombings were the work of a larger terror cell.
Rahami was not on any terror or no-fly watch lists, though he had been interviewed for immigration purposes travelling between the US and Afghanistan, one of the law enforcement officials said.
Rahami and his family live above their fried-chicken restaurant - called First American Fried Chicken - and the family has clashed with the city over closing times and noise complaints, which the Rahamis said in a lawsuit were tinged with anti-Muslim sentiment.
The lawsuit was terminated in 2012 because one of Rahami's brothers had pleaded guilty to blocking police from enforcing closing hours at the restaurant.
'A friendly guy - that's what’s so scary'
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 Rahami was more likely to talk about his interest in cars than to mention faith.
"He's a very friendly guy," patron Ryan McCann said. "That's what's so scary."
Sequence of events
The investigation began when a pipe bomb blew up on 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 exploded on Saturday night in New York's Chelsea section, wounding 29 people, none seriously. An unexploded pressure-cooker bomb was found streets away.
Late on Sunday night, five explosive devices were discovered in a rubbish bin at an Elizabeth train station, about three miles from where Rahami was later found asleep in the doorway of a bar.
Investigators are still gathering evidence and have not publicly tied Rahami to those devices, though Mr Sweeney noted they are not "ruling anything out".
The bombs discovered on Saturday all used flip mobile phones as a trigger and were all made with easily purchasable materials, a federal law enforcement official said.
After zeroing in on Rahami and learning of the car that had travelled between New Jersey and New York, authorities pulled it over on Sunday night after it headed in the direction of Kennedy airport.
The law enforcement officials said at least one of Rahami's relatives was in the car.
All five were questioned and released, Mr Sweeney said. He declined to say whether they might later face charges.
Linden mayor Derek Armstead said the break in the case came on Monday morning when a bar owner reported someone asleep in his doorway.
An officer arrived and confronted Rahami, who pulled a gun and fired, authorities said. The officer was saved by his bulletproof vest. More officers joined in a battle that spilled into the street.
Another police officer was grazed by a bullet. The officers' injuries were not life-threatening.
Around the time Rahami was captured, US president Barack Obama was in New York on a previously scheduled visit for a meeting of the UN General Assembly.
He called on Americans to show the world "we will never give in to fear".