BUFFALO (AP) - President Joe Biden mourned with Buffalo's grieving families on Tuesday, then exhorted the nation to reject what he angrily labeled the poison of white supremacy. He said the nation must “reject the lie” of the racist “replacement theory” espoused by the shooter who killed 10 Black people in Buffalo.

Speaking to victims' families, local officials and first responders, Biden declared that America's diversity is its strength, and warned that the nation must not be be distorted by a “hateful minority.” He promised to “expose” those who promote hateful ideology.

“The American experiment in democracy is in danger like it hasn't been in my lifetime,” Biden said. “It's in danger this hour. Hate and fear being given too much oxygen by those who pretend to love America but who don't understand America.”

He pledged, “In America, evil will not win, I promise you. Hate will not prevail, white supremacy will not have the last word.”

Back at the White House Tuesday evening, Biden laid the blame for the Buffalo incident and others not just on “wackos” who commit hate crimes, but also those who “fill their brains with false ideas.”

As long as he is president, he said, “I'm going to fight like hell and we're going to expose everybody.”

Biden's emotional remarks came after he and first lady Jill Biden paid their respects at a makeshift memorial of blossoms, candles and messages of condolence outside the Tops supermarket, where on Saturday a young man armed with an assault rifle targeted Black people in the deadliest racist attack in the U.S. since Biden took office.

“Jill and I have come to stand with you, and to the families, we have come to grieve with you,” Biden said.

He added: “Now's the time for people of all races, from every background, to speak up as a majority ... and reject white supremacy.”

Replacement theory is a racist ideology, which has moved from white nationalist circles to mainstream, that alleges white people and their influence are being intentionally “replaced” by people of color through immigration and higher birth rates.

In Buffalo, the president was confronting anew the forces of hatred he frequently says called him back to seek the White House.

“It's important for him to show up for the families and the community and express his condolences,” said Derrick Johnson, the president of the NAACP. “But we're more concerned with preventing this from happening in the future.”

It's unclear how Biden can do that. Proposals for new gun restrictions have repeatedly been blocked by Republicans, and racist rhetoric espoused on the fringes of the nation's politics has only grown louder.

Asked about gun legislation, Biden said at the airport, “It's going to be very difficult. ... I'm not going to give up trying.”

Wayne Jones, whose mother Celestine Chaney was killed in the attack, said he appreciated Biden taking time to meet with the families, but he was not optimistic anything will be accomplished in Washington without an end to partisan division.

Money is a big problem, too, he said. “A lot of money is being made from gun purchases -- who needs an AR-15?”

Biden's condemnation of white supremacy is a message he has delivered several times since he became the first president to specifically address it in an inaugural speech. However, such beliefs remain an entrenched threat at a time when his administration has been focused on addressing the pandemic, inflation and the war in Ukraine.

In his remarks Tuesday, Biden paid tribute to each of the 10 people who lost their lives, describing them as beacons of their community and deeply committed to family.

Three more people were wounded. Nearly all the victims were Black, including all of those who died.

The shooter's writings echoed those of the white supremacists who marched with torches in 2017 in Charlottesville, Virginia, a scene that Biden said inspired his decision to run against President Donald Trump in 2020 and that drove him to join what he calls the “battle for the soul of America.”

In Buffalo, Payton Gendron, 18, was arrested at the supermarket and charged with murder. He has pleaded not guilty. His lawyers declined to comment Tuesday.

Before the shooting, Gendron is reported to have posted online a screed overflowing with racism and antisemitism. The writer of the document described himself as a supporter of Dylann Roof, who killed nine Black parishioners at a church in Charleston, South Carolina, in 2015, and Brenton Tarrant, who targeted mosques in New Zealand in 2019.

Investigators are looking at Gendron's connection to what's known as the “great replacement” theory.“

“I condemn those who spread the lie for power, political gain and for profit,” Biden said, stopping short of naming those he believes responsible for perpetuating it.

The replacement claims are often interwoven with antisemitism, with Jews identified as the culprits. During the 2017 “Unite the Right” march in Charlottesville, white supremacists chanted “Jews will not replace us.”

In the years since Charlottesville, replacement theory has moved from the online fringe to mainstream right-wing politics. A third of U.S. adults believe there is “a group of people in this country who are trying to replace native-born Americans with immigrants who agree with their political views,” according to a poll conducted in December by The Associated Press-NORC Center for Public Affairs Research.

Tucker Carlson, the Fox News host, is one prominent TV person who accuses Democrats of orchestrating mass migration to consolidate their power.

“The country is being stolen from American citizens,” he said in August of last year. He repeated that theme a month later, saying that “this policy is called the great replacement, the replacement of legacy Americans with more obedient people from faraway countries.”

Carlson's show routinely receives the highest ratings in cable news, and he responded to the furor Monday night by accusing liberals of trying to silence their opponents.

“So because a mentally ill teenager murdered strangers, you cannot be allowed to express your political beliefs out loud,” he said.

His commentary reflects how this conspiratorial view of immigration has spread through the Republican Party ahead of this year's midterm elections, which will determine control of Congress.

Facebook advertisements posted last year by the campaign committee of Rep. Elise Stefanik, R-N.Y., said Democrats want a “PERMANENT ELECTION INSURRECTION” by granting amnesty to illegal immigrants. The plan would “overthrow our current electorate and create a permanent liberal majority in Washington.”

Alex DeGrasse, a senior adviser to Stefanik's campaign, said Monday she “has never advocated for any racist position or made a racist statement.” He criticized “sickening and false reporting” about her advertisements.

Stefanik is the third-ranking leader of the House Republican caucus, replacing Rep. Liz Cheney, R-Wyo., who angered the party with her denunciations of Trump after the Jan. 6 attack on the Capitol.

Cheney, in a tweet on Monday, said the caucus' leadership “has enabled white nationalism, white supremacy, and anti-Semitism. History has taught us that what begins with words ends in far worse.”

Associated Press writers Robert Bumsted, Karen Matthews and Jennifer Peltz iin New York contributed to this report.