SPARTANBURG, S.C. — The eight major Republican candidates for president joined in a united attack against President Obama as commander in chief during a debate here Saturday, but at times differed sharply over how to block Iran’s nuclear ambitions, the way forward with Pakistan and the use of torture.

The debate, held by CBS News and The National Journal, was the first to focus exclusively on foreign policy, and the candidates seemed more focused on presenting themselves as plausible commanders in chief than on knocking one another off balance.

His fortunes rising in polls, former Speaker Newt Gingrich declined an invitation to repeat his Friday critique of the presumed Republican front-runner, Mitt Romney, as insufficient to the task of changing Washington, saying sternly, “We’re here tonight to talk to the American people about why every single one of us is better than Barack Obama.”

As they warily circled one another on the less familiar ground of foreign policy, the candidates offered some provocative suggestions: Gov. Rick Perry of Texas proposed wiping out standing foreign aid commitments to all nations — including Israel — and making them meet American conditions before receiving a penny; former Senator Rick Santorum of Pennsylvania suggested supporting an Israeli military strike against Iran’s nuclear facilities; and former Gov. Mitt Romney of Massachusetts repeated his assertion that China should lose access to American markets if it will not play by trade rules.

And the candidates laid bare their internal debate about the use of American force and the approach to national security in the post-Bush era, with the most heated discussion focusing on waterboarding and harsh interrogation techniques in general.

Asked whether they would reinstate waterboarding as a method of interrogation for suspected terrorists, Representative Michele Bachmann of Minnesota and Herman Cain said they would, and former Gov. Jon M. Huntsman Jr. of Utah and Representative Ron Paul of Texas declared it torture.

“We diminish our standing in the world and the values that we project, which include liberty, democracy, human rights and open markets, when we torture,” Mr. Huntsman said. “We should not torture. Waterboarding is torture.”

Video

Gov. Rick Perry on Foreign Aid

Gov. Rick Perry of Texas says that if he were president, foreign aid would start at zero for every country including Israel.

Defending the practice, which President Obama has discontinued, Mrs. Bachmann said: “If I were president I would be willing to use waterboarding. I think it was very effective,” adding, “It is as though we’ve decided we want to lose in the war on terror under President Obama.”

On Afghanistan, Mr. Romney said Mr. Obama was moving too soon to draw down the so-called surge troops by next September, arguing that the president was acting out of political motives and that it should wait at least until December of 2012. He added that “the timetable, by the end of 2014, is the right timetable for us to be completely withdrawn from Afghanistan, other than a small footprint of support forces.”

Mr. Huntsman repeated his call for an immediate pullout. “I say it’s time to come home,’’ he said. “I don’t want to be nation-building in Afghanistan when this nation so desperately needs to be built.”

If the debate at times seemed to test the candidates on what has been less familiar ground this campaign season, there were no major gaffes. With help from the CBS moderator Scott Pelley. Mr. Perry successfully made light of his misstep on Wednesday, when he forgot the name of a third federal agency he would seek to eliminate as president, fumbling for the answer — the Energy Department — during 53 painful seconds.

On Saturday, when Mr. Pelley began asking how nuclear weapons would be monitored without an Energy Department, Mr. Perry, smiling broadly, cut in: “I’m glad you remembered it.”

“I’ve had some time to think about it, sir,” Mr. Pelley said, to which Mr. Perry shot back, “Me too.”

After saying that he would start every nation’s foreign aid account at zero dollars, even aid to Israel, he quickly added that he was sure that Israel would qualify for ample aid. (Perhaps mindful of that nation’s special status among many Republican voters, his campaign sent out a statement during the debate reiterating that point.)

And at one point, he referred to the former Soviet Union as Russia in discussing President Ronald Reagan’s prediction that it would “end up on the ash heap of history.” He said the same would apply to the Communist Party leaders of China.

Video

Republican Candidates on Torture

If one candidate seemed particularly on unfamiliar ground it was Mr. Cain, who was not his usual affable self, speaking more deliberately and tentatively in a debate that did not give him a single opportunity to promote his signature “9-9-9” tax plan.

Recently Mr. Cain mistakenly asserted that China was on the verge of acquiring nuclear weapons, though it has had them since 1964. On Saturday he made a point to mention that Pakistan “is one of the nine nations that has a nuclear weapon.”

Mr. Cain said he did not know whether Pakistan was a friend or an enemy, a determination that all the candidates agreed complicated the approach to seeking terrorists and deciding on foreign aid.

An error has occurred. Please try again later.

You are already subscribed to this email.

Mrs. Bachmann and Mr. Santorum argued that Pakistan should continue to receive foreign aid because of its nuclear arsenal. “We can’t be indecisive about whether Pakistan is our friend,” Mr. Santorum said. “They must be our friend.”

When it came to perhaps the most urgent emerging threat, Iran’s nuclear program — and a new United Nations report that said Tehran was making progress toward building a weapon — the three candidates now leading in polls again differed.

Mr. Cain said he would focus on using economic sanctions and aid to the Iranian opposition to pressure the government. “The only way we can stop them is through economic means,” he said, adding that he did not believe that the United States should take military action to prevent Iran from obtaining a nuclear device. He also said that he would “not at this time” entertain military assistance to the Iranian opposition.

While Mr. Romney agreed with Mr. Cain about economic sanctions and aid to Iranian opponents of the government in Tehran, he also said that if nothing else worked, he would use the military. “If all else fails, if after all the work we’ve done there’s nothing else we can do besides take military action, then of course you take military action,” he said. That appears to be the toughest language he has used the campaign about Iran’s nuclear program.

Mr. Gingrich seemed to agree. If “the dictatorship persists,” Mr. Gingrich said, “you have to take whatever steps are necessary to break its capacity to have a nuclear weapon.”

Video

Newt Gingrich on Mitt Romney

Newt Gingrich, former U.S. Speaker of the House, declined to elaborate on his comment about being unsure of Mitt Romney’s capability of changing Washington.

On the other hand, Mr. Paul was sharply critical of the idea. He said that he was concerned that such action would repeat the use of exaggerated and false threats that led to the Iraq war. “I’m afraid what’s going on right now is similar to the war propaganda that went on against Iraq,” he said.

But Mr. Romney kept the onus on Mr. Obama. “Look, one thing you can know,” he said. “And that is if we re-elect Barack Obama, Iran will have a nuclear weapon.”

The CBS/National Journal debate was 10th of the nominating season. But it was the first focused on foreign policy, which has otherwise taken a back seat to the economy in this year’s political discussion.

With the elimination of Osama bin Laden, the fall and death of Col. Muammar el-Qaddafi and successful drone strikes against ranking figures in Al Qaeda, national security has become something of a strong point for Mr. Obama, robbing the Republicans of a traditional line of attack against Democrats.

So Saturday’s debate presented challenges to the Republican candidates as a whole as their party sought to hone a new line of attack against the president on its traditionally secure turf, but also individually. Nearly all of them have struggled in discussing foreign affairs and national security.

The candidates arrived here with a new dynamic in a race that has been shaped — often dramatically — by debate outcomes. Strategists at all of the campaigns, including Mr. Perry’s, agreed that his embarrassing memory lapse on Wednesday intensified questions about his political viability.

Mr. Perry’s campaign team moved quickly to minimize the damage, with a $1 million advertising campaign on Fox News and a round of high-profile television interviews.

But the pressure was back on Mr. Perry to show some grounding in policy. The stakes were at least equally as high for Mr. Cain, who has spent the better part of the last two weeks fending off accusations that he sexually harassed four women when he was the chief executive of the National Restaurant Association in the late 1990s.