President Obama said Tuesday that "justice will be done" in the attempted Times Square bombing as the FBI investigated whether the suspect in the case has ties to terrorist groups.

"We will continue to do everything in our power to protect the American people," Obama said, calling the incident "another sobering reminder of the times in which we live."

"Around the world and here at home there are those who would attack our citizens and would slaughter innocent men, women and children in pursuit of their murderous agenda," the president said.

He said the attack failed because of actions by ordinary citizens who alerted police, and he vowed that America "will not be terrorized."  

The suspect in the failed attack, Faisal Shahzad, was taken into custody late Monday by FBI agents and New York Police Department detectives at Kennedy Airport while trying to board a flight to Dubai, according to U.S. Attorney General Eric Holder and other officials. He was identified by customs agents and stopped before boarding, Holder said early Tuesday in Washington.

Shahzad, 30, is a naturalized U.S. citizen and had recently returned from a five-month trip to his native Pakistan, where he has a wife, according to law enforcement officials who spoke to The Associated Press.

The U.S. attorney's office in Manhattan, which is handling the case, said Shahzad would appear in court Tuesday, but the charges against him were not made public.