Minutes after a man set off a pipe bomb strapped to his body in one of New York's busiest transit hubs, throwing the Monday morning commute into chaos for many, a suspect was in custody, trains were rerouted and throngs of police swarmed the streets.
The massive response exposed the limits of the antiterrorism force the city has built since the deadly attacks of Sept. 11, 2001. It has learned to respond quickly and effectively to attacks but faces an almost impossible task in trying to thwart every threat, particularly the acts of "lone wolves" targeting public places and New York's vast transit system.
Nearly 6 million people ride New York's subway each day, entering at any one of the system's 472 stations - more stops than any other in the world.
That open access is partly what allows U.S. train systems to carry five times as many passengers as airlines but also leaves unique security vulnerabilities, according to a Congressional Research Service report earlier this year.
"You can't search everyone entering a subway system, particularly a system the size of the one in New York," said Tom Nolan, a former U.S. Department of Homeland Security analyst who is now a professor of criminology at Merrimack College in Massachusetts.
No one was killed in Monday's attack, and the person most severely injured was the accused bomber, whom police identified as Akayed Ullah, 27.
New York state Governor Andrew Cuomo sounded relieved when he told reporters that just three other people had been slightly hurt in the attack.
"When you hear about a bomb in the subway station, which is in many ways one of our worst nightmares, the reality turns out better than the initial expectation and fear," Cuomo said.
He had reason to expect worse: Suicide bombers killed 52 people in on London subways and a bus system in 2005, 40 people were killed in the 2010 bombing of the Moscow subway and last year 32 died in coordinated attacks on Brussels' subway and airport.
"This is a fact of life, whether you're in New York or London or Paris," New York Police Department counterterrorism chief John Miller told reporters. "It can happen anywhere."
Dogs, cameras and weapons
A network of cameras blankets almost all of New York's subway system, which sprawls over 665 miles (1,070 km) of tracks. The New York City Police Department uses radiation detectors to search for "dirty" bombs, which combine a traditional explosive with radioactive material, said Anthony Roman, a private security consultant who is familiar with NYPD antiterrorism efforts.
Undercover and uniformed police patrol the system, along with bomb-sniffing dogs, random screening posts and heavily armed tactical officers.
The city's Joint Terrorism Task Force collects intelligence from overseas, and cameras equipped with facial and license plate recognition can help investigators track suspects in real time, Roman said.
But attempting to screen every passenger, as airports do using metal detectors and body scanners, is an impossible task and would only create more opportunities for attacks by causing crowding.
"They will never be 100 percent," Roman said. "The goal is to prevent and deter the vast majority of events, and for those few that occur, minimize their effect by quick, coordinated, interdepartmental response."
The NYPD's Miller said intelligence had stopped at least 26 plots since 2001. But the proliferation of so-called "lone wolf" attackers, who are self-radicalized and not working with an overseas militant group, has made it harder to do so, experts said.
Both Ullah and Sayfullo Saipov, accused of killing eight people on a Manhattan bike lane with a rented truck in the name of Islamic State, appear to have acted alone, according to authorities.
"When you have lone attackers, it's much more difficult," said Max Leitschuh, the senior transportation analyst at the risk management and security consulting company iJET International.
Following Monday's attack, cities including Chicago, Boston and Los Angeles increased security for their mass transit systems.
Ultimately, those efforts are mostly about reassuring the public, said Maria Haberfeld, an expert in police counterterrorism and a professor at New York's John Jay College of Criminal Justice.
"You have to accept it," said Haberfeld, who served in a counterterrorist unit in the Israel Defense Forces. "You can only put so many barriers out there before you abandon the idea of an open society."