LOS ANGELES/CHARLESTON, S.C. (Reuters) - Democratic presidential front-runner Joe Biden on Wednesday accused Republican President Donald Trump of fueling the white supremacy beliefs blamed for several U.S. mass shootings, as Trump visited two cities where 31 people were killed in rampages last weekend.

“In both clear language and in code, this president has fanned the flames of white supremacy in this nation,” Biden, the former vice president, said in a speech in Burlington, Iowa.

Another contender for the Democratic presidential nomination, U.S. Senator Cory Booker, took up the themes of white nationalism and gun violence in a speech at the historically black South Carolina church where white supremacist Dylann Roof shot dead nine people in 2015.

“These acts of hatred do not happen in a vacuum,” Booker said at Emanuel African Methodist Episcopal Church in Charleston. “They are harvested only once they have been planted.”

The weekend’s back-to-back mass shootings intensified criticism of what many say is incendiary rhetoric by Trump.

The president, who has insisted he is not a racist, said Americans must “condemn racism, bigotry and white supremacy” in a speech on Monday.

On Saturday, a gunman killed 22 people in El Paso, a Texas city on the border with Mexico. Law enforcement agencies say the suspected gunman was driven by hatred for Hispanics, citing an online manifesto apparently written by the shooter that was rife with anti-immigrant hatred.

Slideshow ( 11 images )

In the second mass shooting 13 hours later, a gunman in Dayton, Ohio, fatally shot nine people, including his sister, before he was killed by police.

Trump’s rhetoric, including calling Central Americans trying to enter the United States “an invasion,” and his hard-line immigration policies have exposed him to renewed condemnation following the El Paso shooting.

“How far is it from Trump’s saying this ‘is an invasion’ to the shooter in El Paso declaring ‘his attack is a response to the Hispanic invasion of Texas?’ Not far at all,” Biden said in a fiery address.

Trump aides deny his rhetoric was a cause of the shootings. In his national address, the president proposed reforming mental health laws, working with social media to detect possible mass shooters and keeping guns away from people considered potentially violent. He stopped short of calling for major gun law reforms.

Trump visited El Paso and Dayton on Wednesday, where he was greeted by protesters.

Biden and Booker are among 24 candidates vying to become the nominee to take on Trump in the November 2020 election.

Slideshow ( 11 images )

Most of the Democrats have called for stricter gun laws, including universal background checks for purchases and banning assault-style weapons. Booker has also proposed requiring licenses to own firearms.

Biden invoked the rhetoric of previous presidents of both parties, including Republican George W. Bush and Democrat Bill Clinton, who he said “opposed hate.”

“We have a president who has aligned himself with the darkest forces in the nation,” Biden said in Iowa. “We have a president with a toxic tongue who has publicly and unapologetically embraced a political strategy of hate, racism, and division.”

In his remarks, Booker rejected the debate over whether Trump is a racist, saying that what really matters is how people intend to address the problem.

“If the answer to the question, ‘Do racism and white supremacy exist?’ is yes, then the real question isn’t who is or isn’t a racist - but who is and isn’t doing something about it,” he said.