Former US President Barack Obama has called on Americans to reject language from any of their leaders that feeds hatred or normalises racism.
Mr Obama did not name anyone but his rare comments came after President Donald Trump sought to deflect criticism that his anti-immigrant rhetoric had fuelled violence.
In a speech on Monday, Mr Trump condemned hatred and white supremacy.
He was speaking after 31 people died in mass shootings in Texas and Ohio.
While in office, Mr Obama fought unsuccessfully to restrict gun ownership. He told the BBC in 2015 that his failure to pass “common sense gun safety laws” had been the greatest frustration of his presidency.
He has refrained from commenting on Mr Trump’s controversial rhetoric regarding migrants but on Monday issued a statement.
“We should soundly reject language coming out of the mouths of any of our leaders that feeds a climate of fear and hatred or normalises racist sentiments; leaders who demonise those who don’t look like us, or suggest that other people, including immigrants, threaten our way of life, or refer to other people as sub-human, or imply that America belongs to just one certain type of people,” he said.
“It has no place in our politics and our public life. And it’s time for the overwhelming majority of Americans of goodwill, of every race and faith and political party, to say as much – clearly and unequivocally.”
During his presidential campaign Mr Trump said Mexican immigrants included drug dealers, criminals and rapists.
More recently, he caused widespread anger by suggesting that four US congresswomen of colour “go back and help fix the totally broken and crime-infested places from which they came”. He denied his comments were racist.
What did President Trump say?
In a statement from the White House on Monday, Mr Trump called for mental health gun control reforms; the death penalty for those who commit mass murder and more bi-partisan co-operation over gun laws.
“Mental illness and hate pull the trigger, not the gun,” Mr Trump said.
He did not express support for gun control measures proposed in Congress.
“In one voice, our nation must condemn racism, bigotry and white supremacy,” Mr Trump said. “These sinister ideologies must be defeated. Hate has no place in America.”
The president also outlined a number of policies, including more co-operation between government agencies and social media companies, changes to mental health laws as well as ending the “glorification of violence” in American culture.
He called for red flag laws that would allow law enforcement authorities to take away weapons from individuals believed to be a threat to themselves or others.
Mr Trump said government agencies must work together and identify individuals who may commit violent acts, prevent their access to firearms and also suggested involuntary confinement as a way to stop potential attackers.
He also said he directed the justice department to propose legislation to ensure those who commit hate crimes and mass murders face the death penalty.
The president criticised the internet and “gruesome” video games for promoting violence in society.
“It is too easy today for troubled youth to surround themselves with a culture that celebrates violence,” he said. “We must stop or substantially reduce this and it has to begin immediately.”
But he did not address the criticisms of his own harsh rhetoric against illegal immigration, which opponents say has contributed to a rise in racially-motivated attacks.
Mr Trump drew criticism after he incorrectly referred to the Ohio city of Dayton – where nine people were killed in one of two mass shootings that occurred just 13 hours apart – as Toledo.
“May God bless the memory of those who perished in Toledo, may God protect them. May God protect all of those from Texas to Ohio,” he said before walking off stage.
President Trump will visit El Paso on Wednesday.
What happened in Texas and Ohio?
Saturday’s shooting at a Walmart store in El Paso, Texas, left 22 people dead and 26 wounded.
The suspect was arrested and has been named as Patrick Crusius, a resident of the city of Allen, near Dallas. He is believed to be the author of a document posted online before the shooting which said the attack was “a response to the Hispanic invasion of Texas”.
Then in the early hours of Sunday, a gunman killed his sister and eight others in Dayton, Ohio. Twenty-seven others were injured.
The suspect, 24-year-old Connor Betts, was shot dead by police. Officials have not yet suggested a motive for the attack and police said on Monday it was unclear whether he had intended to kill his sister.