Demonstrators protest the visit of US President Donald Trump to the site of the mass shooting in Dayton, Ohio, on August 7, 2019.

U.S. President Donald Trump on Wednesday visited the Ohio city that suffered one of last weekend's two deadly mass shootings that shocked the country, even as critics and protesters accused him of inflaming tensions with anti-immigrant and racially charged rhetoric.

Trump visited survivors, first responders and staff at Miami Valley Hospital in Dayton, Ohio, where nine people and the suspect were killed in a rampage early on Sunday.

Dozens of protesters outside the hospital set up a "baby Trump" blimp balloon and held signs reading "Do Something," "Save our city," and "You are why."

Later in the day, Trump will visit the Texas city of El Paso, on the border with Mexico, where 22 people were killed at a Walmart store on Saturday by a 21-year-old man who had posted an anti-immigrant manifesto online.

The back-to-back massacres, occurring 13 hours apart, have reopened the national debate over gun safety and led protesters in Dayton to heckle Ohio's Republican governor, Mike DeWine, at a vigil for the shooting victims with chants of "Do something!"

As he left the White House, Trump said he wanted to strengthen background checks for gun purchases and make sure mentally ill people did not carry guns. He predicted congressional support for those two measures but not for banning assault rifles.

"I can tell you that there is no political appetite for that at this moment," Trump told reporters at the White House. "But I will certainly bring that up ... There is a great appetite, and I mean a very strong appetite, for background checks."

In Dayton, Trump was greeted at the airport by a bipartisan group of state and local officials, including Democratic Dayton Mayor Nan Whaley, who had said she would welcome Trump but planned to tell him he had been "unhelpful" on the issue of gun violence.

Critics have said Trump stokes violence with racially incendiary rhetoric. The El Paso massacre is being investigated as a hate crime and the FBI said the Dayton shooter had explored violent ideologies.

On Monday, Trump gave a speech focusing on mental health reforms, tighter internet regulation and wider use of the death penalty. Democrats accuse Trump of hiding behind talk of mental illness and the influence of social media rather than committing to laws they insist are needed to restrict gun ownership and the types of weapons that are legal.

In Iowa, Democratic presidential front-runner Joe Biden planned to say in a campaign speech, "We have a president with a toxic tongue who has publicly and unapologetically embraced a political strategy of hate, racism, and division."

In a sign of higher tensions after the shootings, a motorcycle backfiring on Tuesday night in New York's Times Square sent crowds running for fear of another gun attack.

"People are obviously very frightened," New York Governor Andrew Cuomo told CNN.

Authorities in Texas have said they are investigating Saturday's shooting spree in the predominantly Hispanic west Texas border city of El Paso as a hate crime and an act of domestic terrorism. They cited a racist manifesto posted online shortly before the shooting, which they attributed to the suspect.

An open letter to Trump on Wednesday in the El Paso Times described the border city as having "a deep tradition of racial harmony" whose people came together after the tragedy. It admonished Trump for calling El Paso one of the country's most dangerous cities in his February State of the Union address.

"The violence that pierced El Paso, drawing you here today, is not of our own community," wrote editor Tim Archuleta. "An outsider came here to shatter our city, to murder our neighbors. A white man from another Texas city came to target the more than 80% of us who share Hispanic roots."