As Mr Gingrich gained on Mr Romney in the polls, an ex-wife revealed in an interview he wanted an "open marriage".

Meanwhile, Texas Governor Rick Perry pulled out of the race and Iowa said a vote mix-up meant Mr Romney had not won its caucuses.

Mr Romney, a former Massachusetts governor, is the front-runner in the state-by-state race for the Republican Party's nomination to challenge Democratic President Barack Obama for the White House this November.

He is ahead of Mr Gingrich, a former speaker of the House of Representatives, Christian conservative former Senator Rick Santorum and Texas Congressman Ron Paul.

'Grandiose thoughts'

After Mr Gingrich's blistering opening, Mitt Romney's caution on the issue of his tax returns provided the most revealing moment.

Media playback is unsupported on your device

Media captionMr Romney: ''What I have, I earned. I worked hard, the American way''

Asked if he would follow his father's example and release 12 years of returns, Mr Romney - who is worth an estimated $200m (£130m) - said he would release "multiple years", but hesitated in his answer and drew jeers from the crowd.

"I'm not going to apologise for doing well," he said. "What I have, I earned."

The candidates also clashed over healthcare and President Barack Obama's controversial reform law.

Mr Santorum said he doubted Mr Romney and Mr Gingrich would keep their promises to repeal the law, citing their previous support for similar legislation.

The former Pennsylvania senator said he had never supported the individual mandate, while Mr Gingrich and Mr Romney "played footsie with the left" on healthcare.

Analysis

By Paul AdamsBBC News, South Carolina

At the end of a day full of twists and turns, it was perhaps inevitable that one of those twists would explode at the latest Republican debate, here in South Carolina. Newt Gingrich thundered with anger when the debate moderator asked about his second wife's allegation that Mr Gingrich once asked her to tolerate an open marriage, so he could maintain an affair with the woman who went on to become his third wife.

His rivals all diplomatically avoided the issue, conscious that the media is doing their work for them. Newt Gingrich has been enjoying a late surge in the polls here and seems to believe he can defeat the current Republican front runner, Mitt Romney.

But in a state with large numbers of socially conservative evangelical voters, stories about a candidate's troubled private life can have an effect. The debate had other lively moments, as the candidates all tried to score some last-minute points, in front of a noisy audience. Polls open on Saturday morning. If Mitt Romney wins here, his eventual nomination will look more certain than ever.

Mr Santorum - who adopted a combative tone throughout the debate - also questioned Mr Gingrich's time as House speaker, a time when he was a close associate of his rival.

"Sometimes you have these worrisome moments," he said, warning that Mr Gingrich could "pop off" at any time, in an echo of Mr Romney's earlier attacks that he was "unreliable".

Mr Gingrich was unapologetic, casting himself as a "rebel" during his congressional days, and arguing that he helped Republicans win a majority in the 1990s.

Perry bows out

Mr Gingrich took the debate stage hours before ABC News broadcast the full details of an interview with his second wife, Marianne.

Despite poll numbers showing him gaining on Mr Romney, the long-time front-runner, his pitch to South Carolina's largely conservative and Christian electorate looked to be under threat by her testimony.