Police arrested the second suspect in the Boston Marathon bombing here Friday night after a day-long manhunt led them to the wounded man hiding in a back yard.

Dzhokhar Tsarnaev, 19, was found after a resident in Watertown saw blood on a boat parked behind his home. The man looked under a plastic cover and saw a man inside the boat, covered in blood.

Officers responded, and they exchanged gunfire with the suspect and threw “flash-bang” grenades into the boat in an attempt to flush him out. The suspect was later seized by a SWAT team after he did not respond to negotiators. Police said Tsarnaev was in serious condition at a hospital.

Tsarnaev’s arrest ended a wrenching week in Boston, which began with the bombings that killed three and injured more than 170 at one of the city’s most cherished events. It ended with another stunning spasm of violence, which began late Thursday night. Tsarnaev and his older brother, Tamerlan Tsarnaev, allegedly killed a police officer, carjacked a Mercedes and engaged police in a shootout in which the elder Tsarnaev was killed.

On Friday night, the city’s ordeal ended with a flood of relief.

“The hunt is over. . . . And justice has won. Suspect in custody,” the Boston Police Department wrote on Twitter. At the scene, bystanders broke into applause. From a passing SWAT truck, an officer returned the sentiment: “Thank you,” he said over the loudspeaker. “It’s been a pleasure.”

“We have a suspect in custody,” said Timothy Alben, the head of the Massachusetts State Police. “We’re exhausted, folks. But we have a victory here tonight.”

The height of those emotions revealed the depth of the damage already done.

In a few days here, the Tsarnaevs had become a new lesson in the awful magnifying power of terrorism. Two unremarkable brothers, armed with low-tech bombs and no apparent escape plan, had allegedly killed four people and held one of America’s great cities in terror.

“Why did young men who grew up and studied here, as part of our communities and our country, resort to such violence?” President Obama said in a statement from the White House late Friday.

Federal officials said they planned to delay giving Tsarnaev his “Miranda” warning, alerting him to a right to counsel and warning of self-incrimination. That is possible, they said, because of an exemption for cases in which public safety is still at risk. Officials planned to question Tsarnaev about possible accomplices or other bombs before reading him the Miranda rights.

Also Friday, the FBI confirmed that its agents in Boston had interviewed Tamerlan Tsarnaev in 2011 at the request of a foreign government. A law enforcement official said the request came from the Russian government, concerned about Tsarnaev’s potential ties to Chechen terrorists. But, after that interview, the FBI did not follow him further, officials said.

As the manhunt ended on Friday, investigators turned to another task: determining how the two had been turned to violence. So far, authorities said they had no proof that anybody beyond the two Tsarnaev brothers was involved in the marathon attacks.

The Tsarnaev brothers are of Chechen heritage. Both were born in the Caucusus region, a cauldron fought over by Chechen separatists, Russian security forces, Islamist extremists and organized crime. They had immigrated legally, and lived for years in the Boston area, where their father, Anzor, was an auto mechanic.

In the past, both men had embraced American passions, according to friends and neighbors. Tamerlan was an accomplished boxer, with a wife and child. Dzhokhar was a wrestler at Cambridge’s public high school who went on to attend the University of Massachusetts-Dartmouth.

On Thursday evening, authorities released photos of the two men, who had been spotted carrying backpacks near the marathon’s finish line.

Their targets, it turned out, had not fled the city or the country. A few hours later, they began a violent rampage just across the Charles River in Cambridge.

About 10:30 p.m., authorities said, the two shot and killed MIT police officer Sean Collier, 26, as Collier sat in his cruiser. It was unclear what triggered that shooting: authorities said surveillance video appears to show the two approaching Collier and killing him without warning.

After that, the men allegedly carjacked a Mercedes-Benz sport utility vehicle, and took the driver with them. At least one brother told the carjacked driver that they were the marathon bombers, officials said. They forced the driver to stop at several bank machines, and took $800 that he withdrew. After a few minutes, the man was left behind at a gas station, unharmed.

From there, the brothers drove about three miles. In Watertown, they engaged in a shootout with police. At some point, the men threw homemade explosives at officers. Boston Transit police officer Richard H. Donahue, 33, was wounded.

During that shootout, authorities said that Tamerlan Tsarnaev left the car, and police tackled him in the street. Then, authorities said, Dzhokhar Tsarnaev — still behind the wheel of the car — swerved at the officers in an effort to hit them.

The officers dodged. Tamerlan did not. He was dragged under the car, and later died at a Boston hospital.

Dzhokhar Tsarnaev escaped on foot, as arriving officers failed to set up a secure perimeter.

It was the first of two times Friday that he would evade a police manhunt. Later in the day — as state authorities issued a massive order for nearly 1 million people to “shelter in place” — officers conducted house-to-house searches over 20 blocks of Watertown.

Tsarnaev, it turned out, had fled to a house that was just outside that search zone. By 6 p.m., authorities conceded that they hadn’t found him and couldn’t be sure where he was.

They lifted the order to stay home. Just after that, the resident in Watertown walked outside and saw the blood. A police helicopter used infrared technology to spot movement underneath the plastic cover.

Inside, Tsarnaev had been wounded by the firefight hours earlier. He may have been wounded again by the exchange of gunfire with officers that surrounded the boat.

Officers tried to negotiate his surrender. There was no response. Finally, a robot pulled back the cover, and the SWAT team pulled him out. He was wounded in the leg and neck.

Clarence Williams, Ed O’Keefe and Jenna Johnson and researcher Julie Tate contributed to this report.

Discuss this topic and other political issues in the politics discussion forums.