Former Sen. Rick Santorum played aggressor for much of the night, trying to inject himself into what seemed increasingly like a two-way race with little more than a day remaining until the South Carolina polls open on Saturday. He accused Gingrich and Romney of "playing footsies with the left" when it came to health care. Both men rejected the allegations.

The debate began a few hours after first word that Romney had been stripped of his Iowa caucus victory, only to be stung a few hours later by Perry's withdrawal and endorsement of Gingrich.

Gingrich, in turn, was accused by an ex-wife of seeking an open marriage so he could keep his mistress.

"Newt's not perfect, but who among us is," said Perry, abruptly quitting the race just before the first-in-the-South primary.

His decision to end a once-promising candidacy left Romney, Gingrich, Santorum and Texas Rep. Ron Paul the remaining contenders in the race to pick a Republican to challenge Democratic President Barack Obama this fall.

Nine hours after Perry exited one stage, the four remaining contenders walked onto another for a final pre-primary debate.

Gingrich angrily denounced the news media for putting his ex-wife front and center in the final days of the race. "Let me be clear, the story is false," he said. Santorum, Romney and Paul steered well clear of the controversy. "Let's get onto the real issues, that's all I've got to say," said Romney, although he pointed out that he and his wife, Ann, have been married for 42 years.

The audience gave Gingrich a standing ovation when he assailed the media, a reaction he can only hope is reflected in voter sentiment on Saturday.

All four remaining GOP candidates lustily attacked Obama, while Santorum in particular sought to raise his own profile.

Introduced to the audience at the outset, he mentioned his change of fortunes in Iowa, where an evident eight-vote defeat in caucuses on Jan 3 was belated transformed into a 34-vote advantage — though the Iowa Republican Party did not declare a winner.

Santorum jabbed at both Gingrich and Romney, but seemed to focus more attention on the former. If Gingrich is the party nominee, he said, "you sort of have that worrisome moment that something's going to pop. And we can't afford that in a nominee."

In a reflection of the complex political dynamics of the race, first Gingrich and then Santorum challenged Romney over his well-documented switch of position on abortion. Once a supporter of a woman's life to choose, he now says he is "pro-life."

Gingrich didn't exactly question Romney's change in position, but he didn't embrace it, either, saying, "He had an experience in a lab and became pro-life."

Romney bristled. "I'm not questioned on character or integrity very often. I don't feel like standing here for that."

Recent polls, coupled with Perry's endorsement, suggested Gingrich was the candidate with the momentum and Romney the one struggling to validate his standing as front-runner. Whatever else the impact, the day's events reduced the number of contenders vying to emerge as Romney's principal conservative alternative.

The former Massachusetts governor had other challenges in a state where unemployment approaches 10 percent. He adamantly refused to explain why some of his millions were invested in the Cayman Islands, how much was there or whether any other funds were held offshore.

Under pressure from his rivals to release his income tax returns before the weekend — a demand first made by Perry in a debate on Monday — he told reporters it wouldn't happen. "You'll hear more about that. April," he said, a position he renewed during the debate to jeers from the audience.

Gingrich pursued an approach Perry used in the earlier debate.

"If there's anything that's in there that's going to help us lose the election, we should know before the election. If there's not, why not release it?" he said.

Gingrich released his own tax return during the day, reporting that he paid the IRS $613,517 in taxes on more than $3.1 million in income. He also donated about 2 percent of his income to charity.

His effective tax rate, roughly 31.6 percent of his adjusted income, was about double what Romney told reporters earlier this week he had paid.

Gingrich grappled with problems of a different, possibly even more crippling sort in a state where more than half the Republican electorate is evangelical.

In an interview scheduled to air on ABC News, Marianne Gingrich said her ex-husband had wanted an "open marriage" so he could have both a wife and a mistress. She said Gingrich conducted an affair with Callista Bistek — his current wife — "in my bedroom in our apartment in Washington" while she was elsewhere.

"He was asking to have an open marriage and I refused. That is not a marriage," she said in excerpts released by the network in advance of the program.

He said his two daughters from the first of his three marriages — the ex-wife making the accusations was the second of three — had sent a letter to ABC "complaining about this as tawdry and inappropriate."

In fact, the letter made no such accusations. Instead, Kathy Lubbers and Jackie Cushman wrote ABC that anyone who has endured a failed marriage "understands it is a personal tragedy filled with regrets, and sometimes differing memories of events."

Those weren't the only political events in the run-up to the Saturday primary. Television commercials for the remaining candidates and their allies ran virtually without letup, generally designed to diminish each other's support.

According to information made available to The Associated Press, targeted viewers in most regions of the state were watching an average of about six commercials a day paid for by Romney's campaign and Restore Our Future, a group supporting him. Gingrich, Paul, Santorum and their backers raised the total higher.

Santorum ran commercials likening Romney to Obama; Gingrich's cast the former speaker as the only candidate who could defeat the president this fall. In a sign of the shifting campaign, Restore Our Future stopped attacking Santorum so it could concentrate its fire on Gingrich.

Santorum, whose fortunes have ebbed since what appeared to be a narrow loss in Iowa, pronounced himself the winner there after all when state party officials in Des Moines announced he had finished 34 votes ahead of Romney instead of eight behind.

"There have been two contests. We won one," he said, and he proceeded to ridicule Romney and Gingrich as weak challengers to Obama. "How can you differentiate ourselves on the major issues of the day if we nominate tweedledum and tweedledee instead of someone who stood up and said, 'No'?" he said to one audience, referring to his opposition to a requirement to purchase health care coverage.

Iowa Republican chairman Matt Strawn said the party would not name an official winner because the results were so close and some votes couldn't be counted. Results from eight of the state's 1,774 precincts were not certified to the state party by Wednesday's 5 p.m. deadline.

It was Strawn who had stepped before a microphone shortly before 2 a.m. in Des Moines on Jan. 4 to declare Romney the victor.

That announcement propelled the former Massachusetts governor into New Hampshire, where he breezed to victory in the opening primary of the campaign a week later.

He arrived in South Carolina the following day, front-runner then for sure, now more shakily so.

Perry's withdrawal mimicked one earlier in the week by former Utah Gov. Jon Huntsman in that they both quit a few hours before a debate.

The similarities ended there, though. Huntsman endorsed Romney.

Perry had other thoughts, calling Gingrich a "conservative visionary who can transform our country."

Echoing words Huntsman said of Romney, Perry said he and Gingrich had their differences.

And in saying the former speaker was not perfect, he sought to provide political cover of a type that might reassure South Carolina voters for whom religious values are important.

"The fact is, there is forgiveness for those who seek God and I believe in the power of redemption, for it is a central tenet of my own Christian faith," Perry said.

His decision to withdraw set off a scramble among the remaining contenders for the allegiance of his supporters and donors, both in the state and nationally.

State Rep. Chip Limehouse of Charleston said he was expecting to speak by phone with both Romney and Gingrich later in the day before making up his mind.

"I'm looking and I really do think tonight's debate will determine the next president of the United States. That's how important it is," Peeler said.

Perry's exit marked the end of a campaign that began with soaring expectations but quickly faded. He shot to the head of the public opinion polls when he announced his candidacy last summer, but a string of poor debate performances soon led to a decline in support.

His defining moment came at one debate when he unaccountably could not recall the third of three federal agencies he has promised to abolish. He joked about it afterward but never recovered from the fumble.

In his farewell appearance as a candidate, he said he was bowing out of the 2012 campaign, seemingly a hint he would run again in four years if Republicans fail to win the White House this time.

An aide, Ray Sullivan was more explicit, telling reporters Perry hasn't ruled out running for governor again or for the White House in 2016 if Obama is re-elected.