America is "not as divided as some have suggested," President Barack Obama said Saturday, after a "painful" week of police shootings of black men across the nation and an ambush on the Dallas Police Department.

"Americans of all races and all backgrounds are rightly outraged by the inexcusable attacks on police, whether it's in Dallas or anywhere else. That includes protesters, it includes family members who have grave concerns about police conduct," Obama said from Warsaw, Poland, where he was speaking after a NATO summit.

In his first comprehensive remarks on the back-to-back fatal shootings of Alton Sterling in Louisiana and Philando Castile in Minnesota — followed by a sniper attack on 12 Dallas cops by an Army veteran who authorities say "wanted to kill white people" — Obama sought to reassure Americans.

"There is sorrow, there is anger, there is confusion about next steps. But there's unity in recognizing that this is not how we want our communities to operate. This is not who we want to be as Americans," he said ahead of a planned trip to Dallas early next week.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

He called Dallas shooter Micah Xavier Johnson a "demented individual" and said it was hard to untangle his motives for killing five officers and wounding seven others.

But, he added, "in no way does that represent what the overwhelming majority of Americans think. Americans to a large degree want to make sure that we have a police force that is supported, because they know our police officers do a really tough, dangerous job."

Related: Police Killings May Reflect Larger Struggle for Reform

No mass shooter speaks for any minority or group of Americans, Obama said, citing the torrent of violent shootings from the past year that have left dozens dead.

“The demented individual who carried out those attacks in Dallas, he’s no more representative of African-Americans than the shooter in Charleston was representative of white Americans, or the shooter in Orlando, or San Bernardino, were representative of Muslim Americans. They don’t speak for us. That’s not who we are.”

And none of these attacks indicate that the U.S. has slipped backwards in progress toward racial unity, he continued.

"When we start suggesting that somehow, there's this enormous polarization and we're back to the situation in the '60s, that's just not true. You're not seeing riots, and you're not seeing police going after people who are protesting peacefully," he said. "And so as tough, as hard, as depressing as the loss of life was this week, we got a foundation to build on."

Nonetheless, "the issue of guns" desperately needs to be addressed, Obama said in his hour-long comments, vowing to "keep on talking about guns" until Congress passes anti-gun laws.

Related: Dallas Shooter Micah Johnson Was Army Veteran and 'Loner'

Lawmakers have tried — and failed — repeatedly to pass stricter gun laws, most recently last month, when Democrats filibustered for nearly 15 hours on the Senate floor to demand action after the Orlando nightclub shooting killed more than 50 people. Four gun policy measures then failed in the Senate.

"We are not going to be able to identify ahead of time and eliminate every madman or troubled individual who might want to do harm against innocent people. But we can make it harder for them" to obtain weapons, he said.

The U.S. is "unique" among advanced countries in its scale of violence, both between mass shootings and daily gun violence in places like the president's hometown of Chicago.

"You can't set aside the gun issue and pretend that that's irrelevant," he said. "When it comes to the issue of gun safety, there is a polarization between a very intense minority, and a majority of Americans who actually think we could be doing better when it comes to gun safety."