An ambush on police officers at a protest in Dallas that left five officers dead on Thursday night altered the contours of a presidential campaign withHillary Clinton and Donald J. Trump canceling political events on Friday, and striking different tones about the events in Texas, which Mr. Trump called “an attack on our country.”
“It is a coordinated, premeditated, assault on the men and women who keep us safe,” Mr. Trump said in a statement. “We must restore law and order.”
In what seemed a more restrained reaction from a presumptive Republican nominee known for his charged Twitter rants, Mr. Trump also made his first statement about two unarmed black men killed by white police officers earlier this week.
“The senseless tragic deaths of two motorists in Louisiana and Minnesota reminds us how much needs to be done,” he said. “Racial tensions have gotten worse, not better.”
The Louisiana victim, Alton Sterling, was not a motorist, and Mr. Trump later corrected his statement on Facebook to reflect that.
Mrs. Clinton’s campaign on Thursday had proptly declared “Black Lives Matter” on Twitter after video footage of the shootings of Mr. Castile and Mr. Sterling lit up social media and reignited outrage and debate over the treatment of black men by white police officers. On Friday, Mrs. Clinton offered condolences to the families of the police officers killed in Dallas.
“I mourn for the officers shot while doing their sacred duty to protect peaceful protesters, for their families and all who serve with them,” Mrs. Clinton wrote on Twitter on Friday.
She postponed a rally with Vice President Joseph R. Biden Jr. in Scranton, Pa., that had been scheduled for Friday, but planned to address the shootings of Mr. Sterling in Baton Rouge, La., and Philando Castile in Falcon Heights, Minn., and the Dallas attacks, at the African Methodist Episcopal Church conference early Friday evening in Philadelphia.
I mourn for the officers shot while doing their sacred duty to protect peaceful protesters, for their families & all who serve with them. -H
— Hillary Clinton (@HillaryClinton) July 8, 2016
“Too many African-American families are mourning. Too many young black men and women have been taken from us,” Mrs. Clinton’s campaign wrote on Twitter on Thursday.
Mr. Trump, who was also invited to address the A.M.E. conference, a gathering of influential black clergy, didn’t initially respond to the shootings.
But the attack in Dallas, which occured during protests of the shootings of black men by white police officers and was carried out by at least one sniper who said he wanted to shoot white police officers, added urgency for both candidates and their parties to address racial fissures, while showing support for law enforcement officials.
“Our hearts break for the families of these slain officers as well as the families of Alton Sterling and Philando Castile,” Reince Priebus, the chairman of the Republican National Committee, said in a statement. “We are better than racial division, senseless violence, and feelings of lost hope.”
The events in Dallas, came weeks after the attack on a gay nightclub in Orlando, Fla., which forced both Mrs. Clinton and Mr. Trump to scramble to address bigotry, homegrown terrorism and gun violence.
Mrs. Clinton had made criminal justice reform and improving relations between police forces and black communities central to her Democratic primary campaign, calling for an end to the “era of mass incarceration,” and she often campaigned alongside the mothers of black men killed in clashes with the police.
Appearing alongside Mr. Biden would have complicated that message.
The vice president enjoys a close bond with police officers, but he also played a central role in enacting the 1994 Violent Crime Control and Law Enforcement Act. That legislation, signed into law by Bill Clinton, put more police officers on the streets, built dozens of new prisons and created tougher penalties for drug offenders, and has been widely criticized as having an adverse impact on black communities and the high levels of incarceration, arrest, and police presence that have contributed to the current tensions.
A campaign official said the event with Mr. Biden would be rescheduled. Last month, Mrs. Clinton had to reschedule her rally with President Obama, because of the Orlando shootings.
She has not put as much emphasis on the issue of criminal justice in the general election campaign. That is expected to change in light of the deaths of Mr. Castile and Mr. Sterling and the killings of the police officers in Dallas.
If Mr. Trump sought to project a modicum of measured reaction to the shootings, his campaign’s state chairman in Virginia, Corey Stewart, went sharply in a different direction.
Mr. Stewart, who is also reported to be planning a run for governor in Virginia in 2017, posted on Facebook as news of the shooting was breaking, explicitly blaming Mrs. Clinton for the deaths.
“Liberal politicians who label police as racists — specifically Hillary Clinton and Virginia Lt. Governor Ralph Northam — are to blame for essentially encouraging the murder of these police officers tonight,” Mr. Stewart wrote, sharing a link to the ABC News report on the shootings in a post that he later deleted.
Hope Hicks, a spokeswoman for the Trump campaign, said that “Corey does not speak for the campaign and this is not something we agree with.”
Donald Trump Jr., Mr. Trump’s son, also has been active on social media since the shooting, retweeting Joe Walsh, a former congressmen and current radio host, sharing a news story saying Black Lives Matter protesters had been calling for the killing of police officers on Twitter.