Rivals piled criticism on U.S. presidential candidate Rick Santorum at a testy debate on Wednesday, attempting to blunt his surprise surge at a pivotal period in the Republican race.

Looking to build on a late rise in polls, Santorum instead went though an uncomfortable two hours fending off criticism of his Senate record, in his first appearance at centre stage of the debates which have defined the Republican campaign.

Former Massachusetts governor Mitt Romney joined forces with libertarian Congressman Ron Paul in questioning Santorum's conservative credentials. Paul was asked at the CNN-sponsored debate why his campaign had run a television ad calling Santorum a fake.

Because he's a fake, Paul said bluntly.

Santorum, a former U.S. senator from Pennsylvania, often complained earlier in the campaign that he was ignored by moderators in debates. He might have missed an opportunity on Thursday to solidify his lead in many polls.

All eyes are now on Santorum's battle with long-term frontrunner Romney. They are competing fiercely in the February 28 Michigan and Arizona primaries that will set the stage for the crucial March 6 Super Tuesday contest, when 10 states vote.

Romney, his candidacy potentially at stake, went after his chief rival repeatedly. He said Santorum voted to raise the debt ceiling and supported earmarks, the much-ridiculed pet spending projects that members of Congress often slip into appropriations legislation.

Many Republicans would like to ban earmarks spending to help close the budget deficit.

Romney pointed out Santorum had supported a much-derided $400 million bridge to nowhere project in Alaska that was eventually abandoned. Santorum shot back that Romney had sought earmarks to pay for security at the 2002 Winter Olympics in Salt Lake City.

When I was fighting for the Olympics, you were fighting for the 'bridge to nowhere,' Romney told Santorum.

Santorum insisted earmarks have their place.

You don't know what you're talking about, he snapped back at Romney.

TEMPERS FLARE

The debate was the 21st of the 2012 election cycle for Republicans and possibly the last, giving the proceedings a dose of tension.

Tempers flared between Santorum and Romney frequently and at one point the two candidates talked over each other, refusing to cede the floor. At times the crowd booed. Debate moderator John King of CNN frequently let the two candidates battle it out.

The two candidates are in a close race in Michigan, with the most recent polls showing Santorum leading by 4 percentage points or fewer. A victory in Michigan is critical for Romney as he needs to prove he can win in the state where he was born.

Romney again was forced to defend his opposition to bailouts that helped the auto industry in Michigan, a key industry in the state, while supporting bank bailouts during the 2008 financial crisis.

He supported the folks on Wall Street and bailed out Wall Street, was all for it. And then when it came to the auto workers, the folks in Detroit, he said, no. That to me is not a consistent, principled position, Santorum said.

Santorum is the latest Republican candidate to seriously challenge Romney for the party's nomination to face Democratic President Barack Obama in a November 6 general election.

Newt Gingrich, the former Speaker of the U.S. House of Representatives, once a front-runner and now struggling for a breakthrough on Super Tuesday, got strong reviews for his debate performance while letting his rivals slug it out.

Gingrich, who has drawn raves from conservatives for attacking the U.S. news media at the debates, replayed the role once again while talking about contraception and abortion.

I just want to point out, you did not once in the 2008 campaign, not once did anybody in the elite media ask why Barack Obama voted in favour of legalizing infanticide. OK? So let's be clear here, Gingrich said. He was referring to a vote by Obama while he was an Illinois state senator on legislation about the status of fetuses that survive abortion.

(Editing by Alistair Bell and Paul Simao)