Sitting in front of a mural of abolitionist Frederick Douglass, U.S. President Barack Obama visits Anacostia Library to participate in a live "virtual field trip" with middle school students in Washington on April 30, 2015. Obama said on Friday that the nation was watching to see if justice would be served in Baltimore, following the announcement of charges against six Baltimore police officers in the death of 25-year-old African-American resident Freddie Gray. Reuters/Kevin Lamarque

U.S. President Barack Obama on Friday said the nation was watching to see if justice would be served in Baltimore, following the announcement of charges against six Baltimore police officers in the death of 25-year-old African-American resident Freddie Gray. Peaceful protests gave way this week to violence and rioting sparked by the death of Gray, who suffered fatal neck and back injuries while in police custody on April 12, authorities said. Obama, along with civil rights leaders and celebrities, said the Gray case was the latest test in the debate over how to restore trust between law enforcement and communities of color.

"It is absolutely vital that the truth comes out on what happened to Freddie Gray,” Obama said from the White House Friday after the charges were announced. The president said he typically avoids making public comments on ongoing legal matters. “But I can tell you that justice needs to be served," he said. "What I think the people of Baltimore want more than anything else is the truth. That's what people around the country expect."

Baltimore State's Attorney Marilyn Mosby charged the six suspended police officers with offenses that include second-degree murder, manslaughter and official misconduct. After what Mosby called an illegal arrest of Gray, the officers are alleged to have improperly restrained him in a police van. Gray was injured during the ride in the van and was initially refused medical attention when he ask for it, Mosby said.

Representatives of the Baltimore police union on Friday said the officers had not done anything to cause Gray's fatal injuries and called the allegations a "rush to judgment."

On Capitol Hill, the leadership of the Congressional Black Caucus applauded Mosby's "swift and decisive" actions in Gray's case. “This is the first of many steps to begin the process of mending the fractured relationship between law enforcement and the people of the city of Baltimore," said Rep. G.K. Butterfield, D-N.C., the caucus chairman. "Every citizen has a right to due process of law, and we are pleased to see the legal system is working. We continue to call for calm in the weeks and months ahead as we await the outcome of these cases.”

Prominent civil rights leaders, many of whom visited Baltimore in the days since riots broke out, also welcomed Mosby's announcement on Friday. "As the state’s attorney said, Freddie’s death was a homicide, and those responsible must be held accountable through the most severe charges available under the law," said the Rev. Al Sharpton, president of the National Action Network, who held an event with Baltimore officials on Thursday. "But we can’t forget that it’s not only Freddie and his family and community who are owed justice – so too are the families and communities of Eric Garner, Walter Scott, Eric Harris and so many others who are still fighting to have their voices heard."

Sharpton planned a Saturday rally in New York City with the family of Garner, an unarmed black man whose chokehold death at the hands of police in Staten Island last July sparked days of protests throughout the city and the country. A grand jury decided in December against charging the police officer who held Garner in the chokehold.

Eugene "Big U" Henley, who is alleged to be the former leader of the Crips “Rollin' 60s” gang in Los Angeles, but now runs an organization that helps at-risk youths in the Crenshaw neighborhood, said he supported investigators' findings in the Gray case. "We as a people are still looking for justice, all over this nation, where poor people live," Henley said in an email to International Business Times. "May the nation, together with the elected officials, make sure that every officer at least faces charges for a life taken while in their hands."

This week, Baltimore police officials said members of the Bloods and Crips gangs in the city had agreed to a truce in order to harm police officers. Gang members, working with local clergy, have denied that claim.

On Friday, several celebrities took to social media to react to the charges. Ahmir "Questlove" Thompson, drummer with the Roots, the house band on NBC's "Tonight Show Starring Jimmy Fallon," was among those to tweet his reaction after the charges were announced.