Newt Gingrich told a South Carolina town hall audience on Tuesday that he would be open to seeing a Muslim-American run for president, as long as the candidate denounced Sharia law and didn't seek to impose his or her views on others.

At a town hall meeting in West Columbia, S.C., a man asked Gingrich if he would ever "support a Muslim-American running for president."

"Would you endorse...a Muslim-American, [who] could possibly be running for president, given that we had a woman running for president in Hillary Clinton, and we had a Jewish-American, in Joe Lieberman, running for vice president?" he asked.

"A truly modern person who happened to worship Allah would not be a threat," Gingrich replied. "A person who belonged to any kind of belief in Sharia, any kind of effort to impose that on the rest of us, would be a mortal threat."

In the past, Gingrich has repeatedly decried Sharia, a legal code derived from Islam, and called for a federal law to pre-emptively bar its use in any U.S. courts. He didn't soften his position on Tuesday, saying his support would be contingent on a candidate's willingness to denounce Sharia.

"I think it would depend entirely on whether they would commit in public to give up Sharia," he said, referencing his support for the bill and drawing cheers from listeners at the event. "If they're a modern person integrated into the modern world, and they're prepared to recognize all religions, that's one thing. On the other hand, if they're the Saudis, who demand that we respect them while they refuse to allow either a Jew or a Christian to worship in Saudi Arabia, that's something different."

He pointed to an acquaintance as an example of a "truly modern" Muslim.

"We have a friend in Arizona who serves in the U.S. Navy, who's a medical doctor, who's Muslim -- but he's a totally modern person, trying to find ways to bring Islam into modernity," Gingrich said.

Former GOP presidential candidate Herman Cain said he wouldn't be comfortable appointing a Muslim to a judgeship or cabinet position. He later apologized.