President Obama said Friday night that the nation had "closed an important chapter" in the "tragedy" of the Boston Marathon bombings with the capture of Dzhokhar Tsarnaev in Watertown, Mass.

"All in all, this has been a tough week," the president said. "But we have seen the character of our country once more."

Tsarnaev's arrest -- less than 24 hours after he escaped police in a bloody shootout that left his brother and alleged accomplice, Tamerlan Tsarnaev, dead -- ended a four-day manhunt that gripped both Boston and the nation.

Speaking just after Boston officials wrapped up a news conference announcing the capture, Obama declared that "we owe a tremendous debt of gratitude to all our tremendous law enforcement professionals" and said his "thoughts are with those who were wounded in pursuit of the suspect."

One MIT police office was killed and another law enforcement official was badly wounded in the pursuit of the Tsarnaev brothers on Friday.

Bookending his speech Thursday at a memorial service in Boston, the president declared that the accused terrorists had "already failed" in their mission.

"They failed because the people of Boston refused to intimidated," Obama said. "They failed because as Americans, we refuse to be terrorized."

The president also tacitly acknowledged the already-brewing political controversy tied to the attacks. Sen. Chuck GrassleyCharles (Chuck) Ernest GrassleyFormer US attorneys urge support for Trump nominee Dem leaders request bipartisan meeting on Russia probe Overnight Health Care — Sponsored by PCMA — House passes 'right to try' drug bill | Trump moves to restrict abortion referrals MORE (R-Iowa), speaking at a Judiciary Committee hearing on immigration reform Friday, suggested that the bombing should give lawmakers pause as they consider comprehensive reform.

"In this age of instant reporting, tweets, and blogs, there’s a temptation to latch on to any bit of information, sometimes to jump to conclusions," Obama warned, cautioning against ascribing motivations to "entire groups of people."

The president went on commemorate the victims of the bombing, noting "their lives reflected all the diversity and beauty of our country."

The president, who had been briefed throughout the day on the investigation, learned of the news as the nation did, watching the drama unfold on television. FBI Director Robert Mueller later called him to brief him on the capture.

Obama said he had instructed the FBI and intelligence community to "deploy all necessary resources" to continue the investigation, noting that "tonight, there are still many unanswered questions."

"Why did a young man who grew up and studied here ... resort to such violence?" Obama asked.

"It's important that we do this right. That's why we have investigations. That's why we relentlessly pursue the facts."

At the end of his remarks, Obama also took time to acknowledge the victims of the West, Texas, fertilizer plant explosion. Authorities there estimate at least a dozen people were dead and hundreds more were injured in the blast.

"I want them to know they are not forgotten," Obama said. "Our thoughts and prayers are with the people of West, Texas."

In his first public comments on the tragedy, Obama pledged "the people of West will have the resources they need to recover and rebuild."