Just five days after attending a memorial service last week in Dallas for five police officers slain in an ambush, President Barack Obama found himself condemning a similar shooting in Baton Rouge, Louisiana.
On Sunday, he recalled his own eulogy in Dallas: "I said that that killer would not be the last person who tries to make us turn on each other - nor will today's killer. It remains up to us to make sure that they fail. That decision is all of ours. The decision to make sure that our best selves are reflected across America, not our worst - that's up to us."
He warned that with the Republican and Democratic parties formally nominating their presidential candidates for the November elections, the country was "about to enter a couple of weeks ... where our political rhetoric tends to be more overheated than usual."
"And that is why it is so important that everyone - regardless of race or political party or profession, regardless of what organizations you are a part of - everyone right now focus on words and actions that can unite this country rather than divide it further."
Populist billionaire Donald Trump, set to accept the conservative Republican Party's nomination on Thursday, tweeted shortly after Obama's appearance that the president "doesn't have a clue."
"Our country is a divided crime scene, and it will only get worse!" Trump declared. "Our country is totally divided and our enemies are watching. We are not looking good, we are not looking smart, we are not looking tough!"
Trump, running on the slogan "Make America Great Again," had earlier evoked his frequent accusation that Obama has failed to adequately take the fight to Islamic State terrorists in Iraq and Syria.
"We are TRYING to fight ISIS, and now our own people are killing our police. Our country is divided and out of control," he said.
Former first lady Hillary Clinton, who was Obama's secretary of state from 2009-13, will accept the nomination of the liberal Democratic Party on July 28.
"Today's devastating assault on police officers in Baton Rouge is an assault on all of us," she said. "There is no justification for violence, for hate, for attacks on men and women who put their lives on the line every day in service of our families and communities."
Clinton also called for unity in the face of tragedy.
"We must not turn our backs on each other. We must not be indifferent to each other," she said.
"We must all stand together to reject violence and strengthen our communities. Our thoughts and prayers are with the friends and families of the police officers who were killed and injured today."
At the White House, Obama warned: "We don't need inflammatory rhetoric. We don't need careless accusations thrown around to score political points or to advance an agenda. We need to temper our words and open our hearts - all of us."
The July 7 incident in Dallas followed the death of 37-year-old Alton Sterling in Baton Rouge two days before, in yet another killing of unarmed African-American men by police.
Then on July 6, Philando Castile, 32, died after being shot four times by a police officer during a traffic stop near Minneapolis, Minnesota.
The incidents inflamed tensions among minority communities.
Obama pointed to the example set after the killings in Dallas, where "a community came together to restore order and deepen unity and understanding."
"We need the kind of efforts we saw this week in meetings between community leaders and police - some of which I participated in - where I saw people of good will pledge to work together to reduce violence throughout all of our communities," he said.
"That's what's needed right now. And it is up to all of us to make sure we are part of the solution and not part of the problem."