WASHINGTON - President Obama on Wednesday took a veiled swipe at Republican presidential candidate Donald Trump, who has called for blocking Muslims from entering the United States in the aftermath of terror attacks at home and abroad.

Obama was speaking at a Capitol Hill ceremony marking the 150th anniversary of the abolition of slavery with ratification of the 13th Amendment to the Constitution. In his address, Obama detailed the efforts of previous generations to fight discrimination and said Americans today must be willing to do what they did - namely, "to remember that our freedom is bound up with the freedom of others, regardless of what they look like, or where they come from, or what their last name is, or what faith they practice."

Obama drew a standing ovation for his remarks. He did not mention Trump by name. The GOP front-runner's statement has drawn condemnation from lawmakers of both parties and several presidential candidates.

The president said Americans would betray their past if "we were to deny the possibility of movement, the possibility of progress, if we were to let cynicism consume us and fear overwhelm us."

Joined by Republican and Democratic leaders, Obama recounted how slavery shaped American politics and nearly tore the country apart during the Civil War.

He said the country would do a disservice to "warriors of justice" like Harriet Tubman and the Rev. Dr. Martin Luther King Jr. if it denied the scars of the "nation's original sin" were still there today.

"We betray the efforts of the past if we fail to push back against bigotry in all its forms," Obama said.

Trump was nonplussed. "I'm doing good for the Muslims," he declared in an interview to be aired Wednesday night on CNN. "Many Muslim friends of mine are in agreement with me."

After Obama's speech, White House press secretary Josh Earnest said Obama had long promoted the ideas of equal opportunity and rejecting discrimination based on a person's last name, appearance, sexual orientation, or religion. Obama's comments Wednesday were not specifically directed at Trump, Earnest said.

Anti-Islam rhetoric like Trump's "has a devastating effect on our effort to counter ISIL's narrative," Ben Rhodes, the White House deputy national security adviser, told reporters Wednesday.

The Islamic State's message to young recruits is "very simple," Rhodes said: that Islam is at a war with the West, and therefore Muslims have a responsibility to join ISIS and fight.

"We should not be making that easier for them," he added. "We should be making it harder for them."

Also Wednesday, boxing great Muhammad Ali, one of the most famous Muslims in the world, added his voice, criticizing Trump and calling on Muslims "to stand up to those who use Islam to advance their own personal agenda."

In a televised address to the nation Sunday, Obama called on Americans to reject discrimination, saying, "Muslim Americans are our friends and our neighbors, our coworkers, our sports heroes."

On Twitter early Monday, Trump asked: "What sport is he talking about, and who?"

Ali issued a statement saying, in part, "I believe that our political leaders should use their position to bring understanding about the religion of Islam and clarify that these misguided murderers have perverted people's views on what Islam really is."

Staff writer Jonathan Tamari of The Inquirer's Washington Bureau contributed to this article.