WASHINGTON — Donald Trump on Saturday tried to back away from his support for a government database to track Muslims in the United States, an idea that drew sharp rebukes from his Republican presidential rivals and disbelief from legal experts.

Former Florida Gov. Jeb Bush called the prospect of a registry “abhorrent.” Florida Sen. Marco Rubio said the idea was “unnecessary” and not something Americans would support. Texas Sen. Ted Cruz, who has largely avoided criticizing Trump throughout the 2016 campaign, said, “I’m not a fan of government registries of American citizens.”

“The First Amendment protects religious liberty, and I’ve spent the past several decades defending the religious liberty of every American,” Cruz told reporters in Sioux City, Iowa.

The first reference to a database came in a Trump interview with Yahoo News published Thursday. When asked about requiring Muslims to register in a database or carry a form of special identification noting their religion, Trump said, “We’re going to have to look at a lot of things very closely.”

Trump was pressed on the idea of a registry by an NBC News reporter Thursday evening while the candidate campaigned in Iowa. Asked if there should be a database system for tracking Muslims in the United States, Trump said, “There should be a lot of systems, beyond databases.” The reporter asked if that was something Trump would put in place as president. Trump replied: “I would certainly implement that. Absolutely.”

Trump also told the reporter that Muslims would “have to be” registered and said that the registration process could occur at “different places.”

In an interview on Fox News Channel on Friday evening, Trump tried to clarify his position. “I want a watch list for the Syrian refugees that (President Barack) Obama’s going to let in if we don’t stop him as Republicans,” he said.

He said he had trouble hearing the NBC reporter’s questions. He was not asked specifically if he disavowed a general registry for Muslims living in the country, and he did not condemn the idea on his own.

“I want to have watch lists. I want to have surveillance. I mean, we’re not a bunch of babies,” he said.

He once again addressed the issue during a rally in Birmingham, Alabama, Saturday afternoon, telling a crowd in a rambling speech that reports on his previous statements were inaccurate.

“I do want surveillance. I will absolutely take database on the people coming in from Syria if we can’t stop it, but we’re going to,” he told the crowd.

Trump also voiced support for additional surveillance, both of arriving refugees and certain mosques.

“So here’s the story just to set it clear: I want surveillance of these people. I want surveillance if we have to and I don’t care,” said Trump. “I want surveillance of certain mosques, OK. If that’s OK? I want surveillance. And you know what? We’ve had it before and we’ll have it again.”

Trump has also voiced support for closing certain mosques as a way to contain the terrorist threat in the U.S.

The Islamic State group has claimed responsibility for attacks in Paris that killed 130 people and wounded hundreds more. The attacks have raised fears in the U.S. and prompted calls for new restrictions on refugees fleeing war-torn Syria.

The House passed legislation this past week essentially barring Syrian and Iraqi refugees from the United States. Senate Majority Leader Mitch McConnell, R-Ky., has slotted the bill for possible Senate consideration, though it’s unclear whether the chamber could get enough votes to override a threatened veto by President Barack Obama.

The Republican candidates’ unified criticism of Trump was striking.

His rivals have vacillated in how they have handled other inflammatory comments from Trump, apparently wary of alienating his supporters while increasingly concerned that he has held his grip on the race deep into the fall.

Civil liberties experts said a database for Muslims would be unconstitutional on several counts. The libertarian Cato Institute’s Ilya Shapiro said the idea violates basic privacy and liberty rights.

Marci Hamilton, a Yeshiva University legal expert on religious liberty, said requiring Muslims to register appears to be a clear violation of the Constitution’s protection of religious freedom.

“What the First Amendment does and what it should do is drive the government to use neutral criteria,” Hamilton said. “You can use neutral criteria to identify terrorists. What it can’t do is engage in one-religion bashing. That won’t fly in any court.”

Democratic front-runner Hillary Rodham Clinton, at a Tennessee rally Friday evening, said, “Mr. Trump has attacked Mexican immigrants, he’s attacked women and now he’s attacking Muslim Americans. At some point you have to ask yourself, is that the kind of country we are?”

Vermont Sen. Bernie Sanders said Trump’s words were “outrageous and bigoted.”

Vice President Joe Biden, who gave the White House’s weekly Internet and radio address while Obama was in Asia, said IS wants to “manufacture a clash between civilizations,” and to turn away refugees – mostly women, children, orphans, torture survivors – and “say there is no way you can ever get here would play right into the terrorists’ hands.”

On the GOP side, New Jersey Gov. Chris Christie said creating a national registry based on religion and closing mosques “will do nothing to keep us safer and shows a lack of understanding on how to effectively prevent terrorist attacks.”

Ohio Gov. John Kasich said requiring people to register with the federal government because of their religion “strikes against all that we have believed in our nation’s history.”

Ben Carson, the retired neurosurgeon who has challenged Trump’s lead in the GOP race, said the U.S. should have a database on “every foreigner who comes into this country,” but he rejected the idea of tracking U.S. citizens based on their religion.

“One of the hallmarks of America is that we treat everybody the same,” he said. “If we’re just going to pick out a particular group of people based on their religion, based on their race, based on some other thing, that’s setting a pretty dangerous precedent.”

Colvin reported from Spartanburg, South Carolina. Associated Press writers Bill Barrow in Mobile, Alabama; Steve Peoples in Sioux City, Iowa; Catherine Lucey in Des Moines, Iowa; and Julie Bykowicz and Mark Sherman in Washington contributed to this report.