SIMI VALLEY, California (CNN) -- Front-runners John McCain and Mitt Romney attacked each other's conservative credentials as they fought for their party's top spot during the final showdown before the Super Tuesday contests.

The GOP candidates take the stage for Wednesday's debate.

The sharpest exchange in the debate came when Romney, the former governor of Massachusetts, was asked about the McCain campaign's charge that he once said he favored a strict timetable for removing troops from Iraq.

Romney has consistently denied ever having backed a timetable and said McCain was taking a small portion of a quote out of context.

"It's simply wrong," Romney said. "By the way, raising it a few days before the Florida primary, when there was very little time for me to correct the record, falls in the kind of dirty tricks that Ronald Reagan would have found reprehensible." Watch the candidates trade barbs »

But McCain, the Arizona senator who has strongly backed President Bush's Iraq policy, accused Romney of hedging after public support for the war waned.

"I was on the front lines with my friends saying we not only can't withdraw but we've got to have additional troops over there in order for us to have a chance to succeed," he said.

The debate -- sponsored by CNN, the Los Angeles Times and Politico.com -- took place at the Reagan Presidential Library.

McCain -- who has won primaries in New Hampshire, South Carolina and Florida -- hopes to solidify himself as the front-runner, while Romney, the winner in Michigan, Nevada and Wyoming, tries to stop McCain's run to the nomination.

Former Arkansas Gov. Mike Huckabee, winner of the Iowa caucuses, hoped to position himself well among evangelicals and other conservatives to turn around several consecutive losses since Iowa. Long-shot candidate Ron Paul, a representative from Texas, also participated in the debate.

The debate also came on a day when McCain scored a pair of major endorsements that could help deliver two of Super Tuesday's richest prizes.

Former New York Mayor Rudy Giuliani dropped out of the race and endorsed McCain hours before the debate began. And late Wednesday, CNN reported that California Gov. Arnold Schwarzenegger, who was in the audience for the debate, planned to endorse McCain Thursday.

Don't Miss

But Huckabee said investment in infrastructure instead of tax rebates would best stimulate the nation's economy.

"Infrastructure in this country has been neglected," he said. "I don't think there's a governor in this country that wouldn't tell you that you'll create more jobs and you'll build it with American workers, American concrete and American steel. That's stimulus."

On immigration, Romney said those who have come to the United States illegally must return home and "get in line with everybody else that wants to come here."

"People who come here legally are a great source of vitality and strength for our country, but illegal immigration -- that's got to end," he said.

McCain said securing the borders is the "responsibility and the priority" of the American people.

He said he would not vote for the pathway to citizenship part of his original immigration reform plan because the American people do not want it without securing the borders first.

"If we don't have a secure fence and have just this open door that people can come in and out at will, we're never going to deal with this issue effectively and responsibly," Huckabee said.

"It's not that we're building a fence so we can keep our people in or keep people out, but that people who do come here would have to come legally."

With former First Lady Nancy Reagan looking on, Paul disagreed with President Reagan's choice of Sandra Day O'Connor as a Supreme Court justice, while Huckabee and McCain declined to say whether they would have tapped her for a spot on the high court.

Romney said he "would rather have" a different kind of justice on the bench.

The back-and-forth between McCain and Romney threatened to dominate the evening.

McCain sideswiped Romney's credentials as a successful business leader while answering a question about who would best run the nation.

"I think he managed companies and he bought and he sold and sometimes people lost their jobs," McCain said. "That's the nature of that business."

Critics note that Romney's tenure as CEO of the leveraged buyout firm Bain Capital resulted in the loss of thousands of jobs through layoffs and bankruptcies. Romney, the wealthiest candidate in the 2008 presidential race, ran Bain Capital from 1984 to 1999, during which time he earned the bulk of his fortune.

Bain Capital specialized in buying companies in distress and revamping them, often by cutting jobs and closing plants. Some of Bain's purchases became more efficient and successful businesses, while others, loaded with debt from Bain's fees, were forced into bankruptcy, costing more jobs.

Earlier, Romney appeared to go after a perceived a gulf between McCain and the Republican party's conservative base -- much of which has distrusted him since he ran against Bush in 2000.

"He's a good Republican; I wouldn't question those credentials at all," Romney said of McCain. "But there are a number of pieces of legislation where his views are out of the mainstream, at least in my view, of conservative Republican thought."

Romney hit McCain for his opposition to drilling for oil in the Arctic National Wildlife Refuge in Alaska. He also noted that McCain twice voted against tax cuts pushed by President Bush and sponsored campaign-finance reform legislation that he claimed "took a whack at the First Amendment."

McCain defended those stances, saying he wanted spending cuts to go along with the tax cuts.

CNN senior political analyst Bill Schneider said the heated exchange over Romney's Iraq quote was one of the debate's key moments -- and may have favored Romney.

"Romney made a very, very eloquent defense of himself that had some outrage in it," said Schneider. "I do not think McCain looked good in that exchange."

While most analysts said Romney and Huckabee failed to score any major moments that could derail McCain's momentum, Schneider said Huckabee had the best performance of the three.

McCain "may have lost some ground here," Schneider said. "He did not sound like a straight talker at all in this debate."

Democratic presidential candidates Sen. Hillary Clinton and Sen. Barack Obama will face off Thursday at 8 p.m. ET on CNN.E-mail to a friend