Gregory Korte

USA TODAY

WASHINGTON — President Obama heralded the opening of the National Museum of African-American History and Culture on Friday, calling it a timely reminder of the progress made by black Americans — but also the progress left to make.

Referring to the recent police shootings of African-American men in Tulsa and Charlotte, Obama said he hoped that the new Smithsonian museum would help black and white Americans to see current events in a historical context.

"The timing of this is fascinating," he said, departing from his prepared remarks. "Because in so many ways, it is the best of times. But in many ways, these are also troubled times. History doesn't always move in a straight line, and without vigilance, we can move backwards as well as forwards."

Obama said he hopes the museum might cause white Americans to "step back and say, 'I understand, I sympathize, I empathize, I can see why folks might feel angry, and I want to be part of the solution as opposed to resisting change.'"

And, he said, "my hope is that black folks watching some of those same images on television and then seeing the history represented can say to themselves that the struggles we’re going through today are connected to the past, and yet, all that progress we've made tells me I cannot and will not sink into despair,"

Obama's remarks came in a star-studded reception at the White House for supporters and benefactors of the museum, including talk show host Oprah Winfrey, singer Harry Belafonte, record producer Quincy Jones and civil rights leaders like John Lewis, Jesse Jackson and Andrew Young.

Even as Obama spoke, cable networks played and replayed cell phone video of the police shooting of Keith Scott, a 43-year-old African-American man with a traumatic brain injury. That shooting sparked three nights of occasionally violent protests in Charlotte. In a separate incident last week, a police officer in Tulsa shot and killed an unarmed black motorist and has now been charged with manslaughter.

In an interview at the museum broadcast Friday on Good Morning America, Obama said violence is "the wrong way" to protest against police shootings, but said he would stay out of the debate about specific incidents this week so as not to interfere with federal investigations.

"What we've seen over the past several years is that the overwhelming majority of people who have been concerned about police-community relations doing it the right way. Every once in a while, you see folks doing it the wrong way," he said. "Looting, breaking glass — those things are not going to advance the cause."

Obama declined to speak about any specific case, saying he did not want to interfere with the investigations. And as he has in the past, Obama tried to balance the need to correct inequities in the criminal justice system — something he said that "should be a source of concern for all Americans — with support for police officers.

"I think it’s important to separate out the pervasive sense of frustration among a lot of African-Americans about shootings of people, and the sense that justice is not always color blind," he told ABC News. "Police have a really tough job. They’re dealing with people, typically, who are not looking forward to their interaction with police."

Obama will give an address at the museum's grand opening Saturday.