President Barack Obama called the deaths of two black men who were killed by police officers this week “tragic” in a statement released Thursday.

“All Americans should be deeply troubled by the fatal shootings of Alton Sterling in Baton Rouge, Louisiana and Philando Castile in Falcon Heights, Minnesota,” he said in a Facebook post. “We’ve seen such tragedies far too many times, and our hearts go out to the families and communities who’ve suffered such a painful loss.”

Sterling was shot and killed by officers while selling CDs in front of a convenience store in Baton Rouge, Louisiana, early Tuesday morning. Castile was shot Wednesday after being pulled over in the St. Paul suburb of Falcon Heights, Minnesota. Each man’s death was captured on video; both quickly went viral.

Obama recognized the shootings are “not isolated incidents,” saying there are “challenges” in the U.S. criminal justice system. He commended the Justice Department for opening an investigation into the death of Sterling.

“To admit we’ve got a serious problem in no way contradicts our respect and appreciation for the vast majority of police officers who put their lives on the line to protect us every single day,” Obama said. “It is to say that, as a nation, we can and must do better to institute the best practices that reduce the appearance or reality of racial bias in law enforcement.”

Read Obama’s entire statement below: