JERUSALEM — On Israeli soil, U.S. presidential candidate Mitt Romney on Sunday declared Jerusalem to be the capital of the Jewish state and said the United States has “a solemn duty and a moral imperative” to block Iran from achieving nuclear weapons capability.

“Make no mistake, the ayatollahs in Iran are testing our moral defenses. They want to know who will object and who will look the other way,” he said. “We will not look away nor will our country ever look away from our passion and commitment to Israel.”

In his remarks, Romney steered clear of overt criticism of President Barack Obama, even though he has taken on the present administration in the past for not doing enough to prevent Iran from potentially developing nuclear weapons.

The former Massachusetts governor also stepped back from a comment a senior aide made a short while before the speech.

“We recognize Israel’s right to defend itself,” he told the audience. Earlier, the aide, Dan Senor, previewed the speech for reporters, saying that “if Israel has to take action on its own, in order to stop Iran from developing the capability, the governor would respect that decision.”

Israel is the second of three stops on an international trip for Romney in the weeks before he claims the Republican nomination at the national convention in Tampa, Fla.

He flew to the Middle East from Britain, where he caused a stir by questioning whether officials there were fully prepared for the Olympic Games. A stop in Poland will complete his trip.

Romney’s declaration that Jerusalem is Israel’s capital was in keeping with claims made by Israeli governments, even though the United States, like other nations, maintains its embassies in Tel Aviv. He did not say if he would order it moved if he wins the White House.

Even so, his remarks drew a standing ovation from his audience, which included Sheldon Adelson, the American businessman who has said he will donate millions to help elect Romney to the White House.

A goal of Romney’s overseas trip is to demonstrate his confidence on the world stage, but his stop in Israel also was designed to cut into Obama’s support among Jewish voters and donors. A Gallup survey of Jewish voters showed Obama with a 68-25 edge over Romney, according to the poll released Friday.