President Donald Trump condemned white supremacy and racism and vowed to act “with urgent resolve” Monday morning, following two deadly shootings over the weekend in El Paso, Texas, and Dayton, Ohio, that claimed the lives of 31 people.

“These barbaric slaughters are an assault on our communities, an attack on our nature, and a crime against all of humanity,” Trump said from the White House. “Hate has no place in America. Hatred warps the mind, ravages the heart and devours the soul.”

Trump’s remarks were a dramatic a shift in tone from comments the president has often made on Twitter and elsewhere, stoking anger by engaging in attacks against minorities and immigrants. The president also frequently says one thing in front of a teleprompter, then delivers a completely different message in the hours and days that follow.

On Monday, Trump outlined several broad ideas to prevent mass shootings, including preventing individuals deemed a risk to society from having access to firearms and confiscating weapons “through due process." He also called on the Department of Justice to work with social media companies “to develop tools that can detect mass shooters before they strike,” and suggested individuals who commit hate crimes and mass murders should face the death penalty “quickly, decisively, and without years of needless delay.”

Trump also cited video games as a driver of mass shootings, despite the fact there is no evidence of a link between violent games and either weekend tragedy. Numerous studies have shown there is no association between violent video games and aggressive behavior.

“We must stop the glorification of violence in our society. This includes the gruesome and grisly video games that are now commonplace,” Trump said. “It is too easy today for troubled youth to surround themselves with a culture that celebrates violence. We must stop or substantially reduce this and it has to begin immediately.”

Trump did not propose any new gun legislation during his comments, and made a point of mentioning that it was hatred and “not the gun” that pulled the trigger over the weekend. Sen. Chuck Schumer (D., N.Y.) and Rep. Nancy Pelosi (D., Calif.) criticized the president for retreating from a call he made on Twitter hours before his speech to strengthen background checks.

» READ MORE: The gun control movement has had more momentum than ever. But will that matter in the response to El Paso and Dayton?

Trump was also widely mocked for mistakenly mentioning Toledo during his speech, which is about 150 miles north of Dayton, where one of the deadly shootings took place.

Following the shooting in El Paso, where an online screed linked to the suspected shooter attacked immigrants and spoke of a “Hispanic invasion of Texas," Democratic presidential candidates were quick to point to Trump’s divisive rhetoric about race and immigration. A three-month-old clip of Trump laughing at the idea that migrants should be shot to prevent them from entering the country quickly went viral over the weekend.

“That’s only in the Panhandle you can get away with that statement,” Trump joked after a supporter yelled “shoot ‘em!” during the rally in at Panama City Beach, Fla., in May.

On Saturday morning, prior to the shooting in El Paso, Trump once again re-tweeted far-right activist Katie Hopkins, who among other things has referred to migrants as “cockroaches” and called for a “final solution” for Muslims. Hopkins was a former contestant on the U.K. version of Trump’s reality television show The Apprentice.

“You don’t have to use a lot of imagination to connect the dots here,” Democratic presidential candidate Pete Buttigieg, the mayor of South Bend, Ind., said Sunday on CNN. “It is very clear that this kind of is being legitimized from on high. And if that were not true, the president would be acting and speaking very, very differently than what he’s doing right now.”

Staff writer Jonathan Tamari contributed to this report.