He also referred pointedly to Jerusalem as “the capital of Israel,” something Obama administration officials are loath to do, because Palestinians also imagine the city as the future capital of their hoped-for state. The line drew a standing ovation from some in the crowd and, later, an echo from Prime Minister Benjamin Netanyahu, who underscored, “Jerusalem will always be the capital of Israel.”

Mr. Netanyahu, whose relationship with Mr. Obama has been rocky, was generous in his praise of Mr. Romney. “Mitt, I couldn’t agree with you more, and I think it’s important to do everything in our power to prevent the ayatollahs from possessing the capability” to develop a nuclear weapon, the prime minister said earlier in the day. “We have to be honest and say that all the sanctions and diplomacy so far have not set back the Iranian program by one iota.”

The visit, Mr. Romney’s fourth to Israel, coincided with the solemn fast day of Tisha B’av, which commemorates the destruction of the First and Second Jewish Temples of Jerusalem. Between meetings with Mr. Netanyahu, President Shimon Peres and Prime Minister Salam Fayyad of the Palestinian Authority, Mr. Romney and his wife, along with several of the donors, made a pilgrimage to the Western Wall, the holiest site in Judaism and a central symbol of the holiday.

Standing with the chief rabbi of the wall, Mr. Romney, in a black velvety skullcap, was handed Psalm 121 — “He who watches over Israel will neither slumber nor sleep” — and later inserted a note into a crack between the stones, as is traditional (campaign aides declined to reveal its contents).

The scene was more like a campaign rally than a solemn place of prayer. Women stood on chairs to peer over the fence that divides them from the men, many of whom clapped and waved as the candidate and his entourage snaked through; people actually praying were pushed to the back as security officers cordoned off a space for the candidate.