By Brian Montopoli, CBS News

SPARTANBURG, S.C. (CBS NEWS) – Mitt Romney and Newt Gingrich said at the Republican presidential debate here Saturday night that they would be willing to go to war to keep Iran from attaining nuclear weapons if all other strategies failed.

READ MORE: 300+ Astroworld Festival Lawsuits To Be Handled By 1 Texas Judge

Romney said that if “crippling sanctions” and other strategies fail, military action would be on the table because it is “unacceptable” for Iran to become a nuclear power.

Gingrich agreed, saying that if “maximum covert operations” and other strategies failed there would be no other choice.

“If we re-elect Barack Obama, Iran will have a nuclear weapon. And if you elect Mitt Romney, Iran will not have a nuclear weapon,” said Romney.

Ron Paul strongly disagreed with his two rivals, stressing the need to go to Congress before taking military action and saying it isn’t worthwhile to use military force against Iran.

“I’m afraid what’s going on right now is similar to the war propaganda that went on against Iraq,” he said.

Herman Cain also opposed military action against Iran, saying the U.S. should increase sanctions, deploy ballistic missile warships in the region and assist the opposition movement.

The “Commander-in-Chief Debate,” sponsored by CBS News and National Journal, was the first of the 2012 presidential cycle to focus on foreign policy – and the first to appear on network television. For Cain, the stakes were particularly high.

Cain holds a narrow lead among GOP primary voters in the CBS News poll released Friday, with 18 percent of the vote, but he has seen his support weaken in the wake of revelations that he has been accused of sexual misconduct by four women.

Cain, who holds no foreign policy experience, has previously displayed little knowledge of foreign policy issues during the campaign. The debate marked the first test of his ability to articulate his vision on international issues – and the first debate where he would largely be unable to fall back on references to his signature 9-9-9 tax plan.

Cain, along with Michele Bachmann, said he supports the use of waterboarding, which Cain said isn’t torture but an “enhanced interrogation technique.” Paul disagreed, saying “waterboarding is torture” and “torture is illegal” under both U.S. and international law as well as “immoral.” Jon Huntsman sided with Paul, saying waterboarding is torture and the U.S. abdicates its values by engaging in it.

Huntsman also called for the United States to remove its troops from Afghanistan, saying, “this nation has achieved its key objectives.”

In the debate hall, on the campus of Wofford College here in the northern section on the state, the eight candidates were positioned based on their position in the polls – with Cain and Romney at the center of the stage and Huntsman and Rick Santorum on either side. The candidates’ spouses and loved ones were positioned in the front row of the 1,400-person debate hall, so that they could make eye contact with their candidate.

Next to Santorum on the right side of the stage was Rick Perry, who has faded in the polls since his high-profile entry into the race but who remains a serious threat for the nomination thanks in large part to his strong fundraising network.

READ MORE: Texas Man Acquitted In Deadly Shooting Of Police Officer In 2019

The debate was the first for Perry since his disastrous gaffe Wednesday night when he said he wanted to eliminate three government agencies – but couldn’t remember the third. The awkward moment garnered enormous attention, and Perry, who stood at eight percent in Friday’s poll, did a flood of interviews and television appearances on Thursday in an effort to contain the damage, often using humor to discuss the gaffe.

When Perry’s inability to recall that third agency — the Department of Energy — came up, Perry noted with a wry smile that moderator CBS Evening News anchor and managing editor Scott Pelley remembered it.

“I’ve had some time to think about it,” Pelley responded. “Me too,” said Perry, prompting laughter from the audience.

Perry, along with Romney, said military commanders should dictate when troops leave Afghanistan, and he criticized Mr. Obama for setting a date for withdrawal. Romney supports a near-full withdrawal by the end of 2014.

Perry also seemed to back the use of torture, saying “for us not to have the ability to try to extract information from [terrorists] to save our young peoples’ lives is a travesty. This is war. That is what happens in war.”

Special Report: The CBS News/National Journal debate

For Romney, who was tied with Gingrich at 15 percent in Friday’s poll, the debate was a chance to further the notion that he gives Republicans the best opportunity to defeat President Obama next November. Asked which GOP presidential candidate is most qualified to be commander-in-chief in Friday’s poll, Republican primary voters chose Romney more than any other candidate, at 26 percent. And voters see Romney, who is widely seen as having outperformed his rivals in nearly every debate so far, as having the best chance to beat Mr. Obama by a 2-to-1 margin.

But the surging Gingrich, who is seeking to establish himself as the primary alternate to Romney, was a close second on the commander-in-chief question, with 21 percent, and he beat Romney on the question of which candidate is most qualified to handle an international crisis.

Gingrich seemed to split with Romney Saturday night when asked about negotiating with the Taliban in Afghanistan. After Romney said he would not negotiate with the group, Gingrich was asked if you can win the war without doing so. “I don’t think you do,” he replied.

But Gingrich declined to elaborate on his previous criticism of Romney, who he has suggested would be a manager as president, not a transformative leader. Asked if he would discuss that view, Gingrich simply said “no,” going on to say the focus should be on the fact that Romney and the other candidates are superior to President Obama.

Romney and Gingrich agreed that it is acceptable for the U.S. government to kill a U.S. citizen living abroad who has engaged in terrorism against the United States, with Gingrich saying, “if you engage in war against the United States, you are an enemy combatant” and thus lose your rights. He insisted that the “rule of law” would be in effect even if the person had not been convicted in a court of law.

Romney, meanwhile, said the United States is in a trade war with China — and that he would protect the middle class from China’s economic posture.

The debate, moderated by Pelley and National Journal congressional correspondent Major Garrett, was a prime platform for Paul to spotlight his opposition to much of the United States’ military footprint abroad, an issue on which he differs strongly with his rivals.

“We’re pretending we’re at war, we haven’t declared war, but we’re at war against a tactic, and therefore there’s no limits to it,” he said, railing against what he called a civil liberties “mess” that allows presidents to decide to kill U.S. citizens without a trial.  Paul also said the U.S. should stay out of the conflict in Syria.

MORE NEWS: 'I'm Worried I'm Going To Kill My Parents' Man Told 911, Pointed Fake Gun At Fort Worth Police Before Being Killed

Since 1980, the winner of the South Carolina primary has gone on to win the Republican nomination every time. And like national Republican voters, seven in ten of whom say it’s too early to know who they’ll support, CBS News interviews in the state find voters here show no sign they have started to make up their mind.