Receive the latest national-international updates in your inbox

The attacks on public servants and the rule of law "have to stop," President Barack Obama said Sunday after another shooting spree targeting police killed three officers in Baton Rouge and wounded three others.

Obama said the motive for Sunday's attack, the second targeting police in less than two weeks, was unknown, but there was no justification for violence against law enforcement.

"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," Obama said.

As the all-too-familiar scene unfolded in Baton Rouge, Dallas Police Chief David Brown tweeted, "Our thoughts and prayers are with Baton Rouge police."

The city of Dallas is still mourning five slain police officers who were targeted in an ambush during a protest 10 days ago.

Hillary Clinton condemned the attack on law enforcement in Baton Rouge, saying, "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."

Louisiana Gov. John Bel Edwards tweeted: "This is an unspeakable and unjustified attack on all of us at a time when we need unity and healing. Rest assured, Every resource available to the State of Louisiana will be used to ensure the perpetrators are swiftly brought to justice."

In a statement issued Sunday, Attorney General Loretta Lynch said there is no place in the United States for such appalling violence. She also is pledging the full support of the Justice Department as the investigation unfolds.

Reverend Al Sharpton added: "Praying for the families of the police officers shot in Baton Rouge as we await the full details. This senseless violence really must stop."

Law enforcement officials around the country also took to social media to pay tribute to their brothers in blue.

Obama has spent most of the last week focused on defusing tensions and rebuilding trust between police departments and the communities they serve.

The shooting of the police officers in Dallas and Baton Rouge were preceded by police shootings of two black men, Alton Sterling in Baton Rouge and Philando Castile in suburban St. Paul, Minnesota. Those shootings sparked protests around the country. Dallas police were defending protesters in that city when a black gunman, who authorities said "wanted to kill white people, especially white officers,” opened fire on them.

Sterling's nephew, Terrance Carter, spoke to The Associated Press on Sunday and said his uncle would not want this.