Trump consoled victims of mass shootings in Ohio and Texas on Wednesday, but despite promising a message of unity, he continued to rail at opponents while facing protests that his rhetoric on race has fuelled extremism.
Trump flew to El Paso, Texas, where a self-declared white supremacist murdered 22 people last weekend at a Walmart heavily frequented by customers of Hispanic origin.
He spent about an hour and a half at a hospital with staff and victims before he and his wife Melania were driven to the city's emergency operations centre to meet with police officers.
Protesters gathered in the streets, watched by armed police. "Go home. You are NOT welcome here!" and "Trump hatred, racism not welcome here" read two of the signs.
Similar scenes unfolded at an earlier stop in Dayton, Ohio, the site of another mass shooting over the weekend, in which nine people died.
Pro-Trump protesters also took to the streets in both cities, illustrating the sense of division in the country ahead of next year's election.
Journalists were mostly kept away from the Republican president, but in brief comments near the end of the two-city trip, Trump said he'd had an "amazing day."
Then after praising the "heroes" who confronted the killers, Trump used his one appearance before the cameras to reignite his feud with opponents who accuse him of racism and who had argued against him visiting either Ohio or Texas.
"They shouldn't be politicking today," he said, calling Ohio Democratic Senator Sherrod Brown, who questioned the use of Trump's visit to Dayton, "very dishonest."
Apparently stung by the less-than-enthusiastic reception given to him by some leaders in both cities, Trump also made a point of insisting that he'd been treated warmly.
"The love, the respect for the office of the presidency, it was -- I wish you could there to see it," he told journalists.
Trump returned to that theme in a tweet announcing his departure from El Paso, saying: "The Fake News worked overtime trying to disparage me and the two trips, but it just didn't work. The love, respect & enthusiasm were there for all to see."
Earlier, Trump's social media director Dan Scavino tweeted that the president had been treated like a "Rock Star" in the Dayton hospital.
The White House, which had kept away news photographers, saying that it didn't want to treat the visit as a photo-op, subsequently published its own pictures showing Trump alongside medical staff, police and victims.
In Dayton, Trump told shooting survivors that "you had God watching. I want you to know we're with you all the way," according to presidential spokeswoman Stephanie Grisham.
But the traditional presidential role of consoler-in-chief blended awkwardly with accusations that Trump is himself to blame for rising tensions in the United States over race.
Trump vehemently denies any racism but his choice of language, linking Hispanic migrants to murder, rape and invasion, is widely seen as at best incendiary.
A famed border city, El Paso is at the centre of Trump's high-profile political campaign against illegal immigration and his keystone project of building walls along the Mexican frontier.
The killer deliberately sought out the city, claiming to be stopping an "invasion" of illegal migrants -- a term popularised by Trump repeatedly in campaign speeches.
As recently as May, the president laughed and made a quip when a supporter at one of his rallies yelled that they should "shoot" illegal immigrants.
Leading Democratic presidential candidate Joe Biden gave a speech on Wednesday accusing Trump of fanning "the flames of white supremacy."
And Trump, who'd begun the day at the White House by insisting that his rhetoric "brings people together," went on Twitter from Air Force One to respond.
"Watching Sleepy Joe Biden making a speech. Sooo Boring!" Trump wrote, while flying between Dayton and El Paso.
Where Trump and his mostly leftist opponents agree is on the unambiguous designation of the two events as terrorism.
Massacres by mostly lone gunmen are all but routine in the United States, where guns are easy to obtain legally and mass killings have taken on a sort of cult status in extreme circles.
Hardline defenders of gun ownership have long resisted the portrayal of such tragedies as anything more than random, localised events.
But Trump on Monday said he had told the FBI to treat such crimes as "domestic terrorism."
On Wednesday, Trump also said that Republicans and Democrats were "close" to agreeing on stronger background checks for people buying firearms -- a measure opposed by gun rights lobbyists.
"I think background checks are important. I don't want to put guns into the hands of mentally unstable people or people with rage or hate," Trump said.
However, he said "there is no political appetite" for banning military style assault weapons, which are widely available and are often chosen by mass killers.