WASHINGTON (AP) - President Barack Obama angrily denounced Donald Trump's anti-Muslim rhetoric on Tuesday, blasting the views of the presumptive Republican presidential nominee as a threat to American security and a menacing echo of some of the most shameful moments in U.S. history.

Obama's rebuke was his most searing yet of the man seeking to take his seat in the Oval Office. While the president has frequently dismissed Trump as a buffoon or a huckster, this time he challenged the former reality television star as a "dangerous" threat to the nation's safety, religious freedom and diversity.

"That's not the America we want. It does not reflect our democratic ideals," Obama declared in remarks that had been scheduled as simply updating the public on the counter-Islamic State campaign.

Obama walked listeners through a familiar litany of battlefield successes, but then came another message. Growing more animated as he spoke, Obama said Trump's "loose talk and sloppiness" could lead to discrimination and targeting of ethnic and religious minorities.

"We've gone through moments in our history before when we acted out of fear and we came to regret it," Obama said. "We've seen our government mistreat our fellow citizens and it has been a shameful part of our history."

Read More: Donald Trump, Wannabe Movie Mogul? The Little-Known Story of His Almost-Hollywood Studio

Trump responded by suggesting that Obama is too solicitous of enemies.

"President Obama claims to know our enemy, and yet he continues to prioritize our enemy over our allies, and for that matter, the American people," the candidate said in a statement. "When I am president, it will always be America first."

At a fiery rally hours later in Greensboro, North Carolina, Trump said the president appeared angrier at him than he was at the Orlando gunman. "That's the kind of anger he should have for the shooter and these killers that shouldn't be here," Trump told the crowd.

Sunday's mass shooting in Orlando, Florida, has set off a new round of debate over counterterrorism, gun control and immigration - one that has exposed the political parties' starkly different approaches to national security. The presumed gunman was an American-born citizen whose parents came to the U.S. from Afghanistan more than 30 years ago.

Trump has used the carnage to renew his call to temporarily ban foreign Muslims from entering the country, and added a new element: a suspension of immigration from areas of the world with a proven history of terrorism against the U.S. and its allies.

Read More: Bill O’Reilly Says Trump's Orlando Tweet Is a "Political Response" to "Bolster His Popularity"

The Democrats' presumptive presidential nominee, Hillary Clinton, also let out a full-throated response that Trump's speech should disqualify him.

"We don't need conspiracy theories and pathological self-congratulations," Clinton said Tuesday in a speech that closely tracked Obama's. "We need leadership and concrete plans because we are facing a brutal enemy."

Both Clinton and Obama turned up the heat on Republicans, some of whom have squirmed with discomfort this week at the first glimpses of how their new leader handles national crises.

As Obama argued that Trump's ban on immigration would lead Muslim-Americans to believe their government had betrayed them, he urged Republicans to denounce the policy.

"Where does this stop?" Obama said. "Are we going to start treating all Muslim-Americans differently? Are we going to start subjecting them to special surveillance? Are we going to start discriminating against them because of their faith? ... Do Republican officials actually agree with this?"

Read More: Donald Trump and Hillary Clinton at Odds Over Orlando Attack

For some, the answer was plainly no. House Speaker Paul Ryan of Wisconsin, the highest-ranking elected GOP official, emphasized his opposition, saying he did not think such a ban was "in our country's interest" or "reflective of our principles not just as a party, but as a country."

Republicans have instead hoped to focus on a broader criticism of the president's counterterrorism strategy as unfocused, ineffective and too soft of Islamic institutions and governments that support terrorism.

Obama directly addressed that argument, specifically taking on the Trump charge that his policies have been hampered by his refusal to use the phrase "radical Islam" when describing the forces urging attacks like the one in Orlando. Republicans have said the careful parsing is a sign of over-caution and political correctness that demonstrates denial about the groups responsible for the extremist view.