In a forceful statement Sunday afternoon, Obama condemned the recent attacks on police officers in Dallas and Baton Rouge and promised that "justice will be done."

"There is no justification for violence against law enforcement. None. These attacks are the work of cowards who speak for no one," Obama said in a statement "The officers in Baton Rouge, the officers in Dallas — they were our fellow Americans, part of our community, part of our country, with people who loved and needed them, and who need us now — all of us — to be at our best."

Speaking to reporters later in the White House briefing room, the President called for unity and warned speakers at the upcoming Republican and Democratic conventions this month to temper their political rhetoric.

"Five days ago, I traveled to Dallas for the memorial service of the officers who were slain there. I said that killer would not be the last one that tries to make us turn on each other. Nor will today's killer. It remains up to us to ensure that they fail," Obama said.

He added: "Everyone right now focus on words and actions that can unite this country rather than divide it further. We don't need inflammatory rhetoric. We don't need careless accusations thrown around to score political points or score an agenda. We need to temper our words and open our hearts."

Obama's statement Sunday echoed his remarks during the memorial service for five Dallas police officers who died earlier this month after a gunman targeted city police officers following a peaceful protest. In a speech early last week, Obama called for unity in the face of violence.

The president was one of many public figures on Sunday who spoke out against the attack.

In a Facebook post Sunday, presumptive Republican presidential nominee Donald Trump denounced the shooting and claimed that a "lack of leadership" has encouraged violence against law enforcement

"We grieve for the officers killed in Baton Rouge today. How many law enforcement and people have to die because of a lack of leadership in our country? We demand law and order," Trump wrote.