With the Republican convention beginning in Cleveland with a theme of bringing law and order back to a fractured nation, Hillary Clinton told black leaders in Cincinnati on Monday that the country had “difficult, painful, essential work” ahead in rebuilding trust between African-Americans and police officers.

“This madness has to stop,” Mrs. Clinton told civil rights leaders and activists gathered at the annual convention for the N.A.A.C.P., a day after three law enforcement officers were fatally shot in Baton Rouge, La.

President Obama called for calm on Sunday, while the presumptive Republican presidential nominee, Donald J. Trump, asserted that the United States had become a “divided crime scene.” And Mrs. Clinton on Monday fell somewhere in between, urging more empathy but insisting she would crack down on any violence against the police.

“We need to recognize our privilege and practice humility,” she said of white people. “Imagine what it would be like to sit our son or daughter down and have the talk about how carefully they need to act around police.”