Republican presidential hopefuls have promised to go to war to stop Iran obtaining a nuclear weapon, painting Barack Obama's handling of Tehran as the most serious of a string of overseas failures.

Mitt Romney, the favourite to clinch the party's candidacy, said that he would direct US forces to pre-emptively strike Iran's nuclear facilities if "crippling sanctions" failed to block their ambitions.

"If all else fails, if after all of the work we've done, there's nothing else we could do besides take military action," Mr Romney said at a debate on foreign policy in South Carolina on Saturday night.

The former Massachusetts governor's pledge was echoed by Newt Gingrich, the former Speaker of the House of Representatives, who over the weekend rose to second place in some national opinion polls.

"You have to take whatever steps are necessary to break its capacity to have a nuclear weapon," said Mr Gingrich, who also proposed covert actions such as "taking out their scientists," to applause. Rick Santorum, a former Senator for Pennsylvania, said the US should support an Israeli intervention.

Their remarks came at the end of a week of heightened tensions following the UN nuclear watchdog's confirmation that Iran had acquired the expertise and material required to build its first nuclear weapon.

The International Atomic Energy Agency (IAEA) also acknowledged for the first time that Tehran was conducting secret experiments whose only purpose could be the development of weaponry.

As his potential Republican rivals spoke, Mr Obama was being rebuffed by Presidents Hu Jintao of China and Dmitry Medvedev of Russia as he sought international support for sanctions against Tehran.

After meetings at an Asia-Pacific Economic Co-operation (APEC) summit in Hawaii, Mr Obama said that Russia had agreed to "work to shape a common response" to Iran's threatening manoeuvres, and that China wanted Tehran to obey "international rules and norms".

However, neither foreign leader publicly echoed Mr Obama's comments or signalled that they might withhold their veto on the UN Security Council if sanctions against Iran were proposed by the US.

Iran insists its nuclear programme is limited to the peaceful production of energy. Dismissing the IAEA report as "absurd", President Mahmoud Ahmadinejad last week said he would not retreat "one iota".

Mr Obama's Iran problem was pounced upon by Republicans as evidence that despite overseeing the killing of Osama bin Laden and endorsing Nato intervention in Libya, his foreign policy is weak.

Calling the situation the president's "greatest failure," Mr Romney said: "If we re-elect Barack Obama, Iran will have a nuclear weapon. If you elect Mitt Romney, Iran will not have a nuclear weapon".

Mr Romney also accused Mr Obama of pulling US troops out of Afghanistan too quickly for political reasons. Michele Bachmann, a Minnesota congresswoman, said that under Mr Obama the US was acting "as though we've decided we want to lose in the war on terror".

Rick Perry, the Governor of Texas, said meanwhile that under his presidency, aid to all countries – including Israel – would be reset to "zero dollars", and foreign leaders would have to argue their case anew.

The remark raised concerns among some Israeli groups, whose generous backing from the US typically goes unquestioned. The Republican Jewish Coalition said it hoped Mr Perry's team would "brief their man on the 10-year memorandum of understanding that governs US-Israel funding levels." Mr Perry later clarified that he expected Israel would receive "substantial" funding. Aides to Mr Romney, who said during the debate that he agreed with Mr Perry about resetting all aid budgets, stressed that he had not been talking about Israel.

It came during an otherwise cautious performance from Mr Perry, who suffered embarrassment during last week's debate in Michigan when he could not remember the name of the Energy department, one of three that he proposes to abolish.

Herman Cain, the former pizza chain owner, attacked Mr Obama for supporting the Arab spring uprisings. He accused him of facilitating the rise of political Islam in Egypt and being disloyal to Ali Abdullah Saleh, the Yemeni president, who Mr Obama now says should step down.

"He is our friend. He has been helping us fight al Qaeda," said Mr Cain. "This president has been on the wrong side in nearly every situation in the Arab world."

Some of the candidates also expressly endorsed the controversial waterboarding interrogation technique – in which subjects are repeatedly made to feel they are drowning.

Without naming waterboarding, Mr Perry said that any techniques that might "save young American lives" would be approved if he were in the White House.

Mr Cain called it an "enhanced interrogation technique" – the phrase used by the Bush administration before the practice was banned in 2006.

Mrs Bachmann said she would allow waterboarding because it had been "very effective" under Mr Bush. Ron Paul and Jon Huntsman both condemned the practice.