NEW YORK — The man who police said sowed terror across two states, setting off bombs in Manhattan and on the Jersey Shore and igniting a furious manhunt, was tracked down Monday morning sleeping in the dank doorway of a neighborhood bar and taken into custody after being wounded in a gunbattle with officers.

The frenzied end came on a rain-soaked street in Linden, N.J., four hours after the police issued an unprecedented cellphone alert to millions of people in the area telling them to be on the lookout for Ahmad Khan Rahami, 28, who was described as “armed and dangerous.”
Advertisement
Even as the remarkably swift arrest eased fears across the region, investigators were still in the earliest stages of trying to determine what provoked the attacks, why a street in Chelsea was one of the targets, and whether the bomber was aided by others. While investigators have been focused on Rahami’s actions immediately before and after the bombings, they were also working to trace his activities and travel in recent years.
One law enforcement official said the bomb technicians involved in the investigation believed Rahami constructed all the devices and his handiwork raised the possibility he had received training from someone with experience.
“If you’re working off the premise that the guy made all these devices,” the official said, “then the guy is a pretty good bomb-maker. And you don’t get that good on the Internet.”
Rahami and his family had traveled periodically to Pakistan, and on one trip, he stayed for nearly a year. A senior law enforcement official said no evidence had yet been uncovered that he had received military training abroad. The official said FBI agents were examining Rahami’s electronic devices as part of an effort to determine if he was inspired or directed by the Islamic State or any terrorist organization.
Advertisement
Assistant Director William F. Sweeney, who heads the FBI’s New York office, said investigators had not found any indication there is a terrorist cell operating in the area or in the city.
RELATED: Lately, bombing suspect was a different person
The arrest was the culmination of a sweeping, connect-the-dots manhunt that grew in urgency as police and FBI agents pieced together clues gleaned from both high-tech investigative tools and practiced detective work.
The weekend began with what seemed like an odd and troubling event but one that hardly aroused widespread alarm. At 9:30 a.m. Saturday, three pipe bombs tied together blew apart a trash can before the scheduled start of a Marine Corps run called Seaside Semper Fi in Seaside Park, N.J.
Only one of the three bombs had detonated and no one was injured. The FBI was brought in to investigate, but there was no indication about what would unfold 11 hours later.
Investigators believe Rahami drove a car registered to his father into New York City shortly before the Chelsea blast erupted at 8:30 p.m.
In a review of surveillance video, the police saw him near West 23rd Street and the Avenue of the Americas wearing a backpack investigators believe contained one pressure cooker bomb. He was pulling a patterned duffle-type rolling bag that they believe contained another pressure cooker bomb.
A short time later, a powerful explosion propelled shrapnel and shattered windows up and down the block. The bomb, placed under a Dumpster on the busy crosstown thoroughfare, injured 29 people.
Advertisement
City streets were locked down and a tip to 911 led police to a second device, the other pressure cooker bomb with a cellphone attached, four blocks to the north. Surveillance video collected by investigators would later show Rahami on West 27th Street, without his backpack and leaving the other bag beside a mailbox.
But it would take hours to gather and analyze all of that video and zero in on Rahami as the man who left the bags behind. All officials knew Saturday night was that someone had deliberately placed bombs on a city street. Mayor Bill de Blasio wAs hesitant to call it an act of terrorism and officials cautioned against linking the attack to the explosion in New Jersey.
The unexploded bomb held critical clues. Once the police were able to remove it and examine it, they discovered a fingerprint that matched one in an arrest record for Rahami.
They also found similarities between the New York and New Jersey bombs, leading them to reverse their conclusion that they were not linked.
Most or all used old-style flip phones — an LG and a Samsung on the two Manhattan devices and an LG in Seaside Park — as timers, with Christmas-tree-style lights as initiators, the officials said. They said HDMT served as the detonator and a compound similar to a commercial explosive known as Tannerite served as the main charge in some devices.
By Sunday, the authorities were monitoring addresses associated with Rahami. Increasingly confident that he was involved with the bombings, they made the decision to act when they saw a vehicle leaving one of those addresses.
Advertisement
Roughly 20 minutes after Rahami left the bag on West 27th Street, two men happened upon on the luggage, apparently unaware of its explosive contents. One of the men opened the bag, pulled out the bomb, which was inside a white plastic bag, and then left with the luggage. The authorities, who are eager to talk to the men, said their handling of the device may have disabled it.
The car was pulled over on the Belt Parkway near the Verrazano-Narrows Bridge in Brooklyn. Five people inside, some of them Rahami’s relatives, were questioned and released.
Late Sunday, police received a report of a suspicious package near a train station in Elizabeth, N.J. The FBI deployed robots to examine the bag and determined it held five bombs.
Around 12:30 a.m., the robots tried to disarm one bomb and accidentally detonated it. No one was injured.
The location of the bag was close to where the Rahami family ran a restaurant, and before dawn Monday, federal agents and local police officers were swarming the neighborhood.
They searched the restaurant, First American Fried Chicken, and addresses where Rahami was reported to have spent time.
As investigators realized that all of the attacks were linked and that the bombs reflected a certain level of sophistication, they worried that the bomber would grow desperate and do something even more drastic.
Advertisement
They decided to take the unprecedented measure of using New York City’s emergency notification system — typically for major weather events — to alert people in the region that a dangerous suspect was on the loose. Shortly after 7 a.m. millions of people in the region received the notification to be on the lookout for Rahami.
Video shows bombing suspect Ahmad Rahami in custody in Linden, New Jersey. pic.twitter.com/NrVJCPNAkC
— Eyewitness News (@ABC7NY) September 19, 2016
Rahami, however, was seeking shelter from the morning rain under a doorway of Merdie’s Tavern in the nearby town of Linden. Around 10:30 a.m. the bar owner spotted a man sleeping in the doorway, officials said.
Captain James Sarnicki of the Linden Police Department said an officer approached the man, later identified as Rahami, and when he woke him, he saw that he had a beard resembling that of the man on the wanted poster.
The officer ordered him to show his hands, Sarnicki said, but instead, he pulled out a handgun, shooting an officer in the abdomen; the bullet struck his vest.
“The officer returned fire,” he said. Rahami fled, “indiscriminately firing his weapon at passing vehicles.”
Other officers joined the chase, and Rahami was shot multiple times. At least one other officer was wounded.
Shortly after 11 a.m., Rahami was in custody, splayed out in the street, hands cuffed behind his back. Blood pouring from a wound in his shoulder and splattered on his face, he was loaded onto a stretcher and admitted to University Hospital in Newark.
Jack Mazza, a friend of the bar owner, said he couldn’t believe it when he heard the arrested man was the bomb suspect. “The cops came and . . . he woke up,” Mazza said in a telephone interview with The Boston Globe, describing how the officer asked for identification before being allegedly attacked. “He shot him in the stomach.”
“You hear the gunfire go out,” Shawn Stiles, assistant manager of a nearby body shop, said in an interview with the Globe. “We go outside and look, and not even a block down the street we saw a guy shooting at police and police shooting back.’’
Stiles said police were chasing the man when he lost sight of them. “You see three or four more cop cars fly by and hear 20 or more shots,” Stiles said.
He said Rahami was taken into custody about three blocks away.

Diego Jeronimo, 36, the owner of a store near where the gunbattle unfolded, said he opened his front door and saw a police car parked lengthwise across the street, an officer with his back to him with his gun drawn using the car as a shield. He heard around five shots.
“Then it calmed down a little bit, then we hear seven shots, but they were more distant,” he said.
Shawn Styles, 30, who works at Linden Auto Body next door, said he saw numerous police vehicles whiz down the avenue.
“Then multiple, multiple shots,” he said.
Rahami was charged with seven counts, including five counts of attempted murder of a law enforcement officer, with bail set at $5.2 million.
Globe correspondent Dylan McGuinness contributed to this report.