Mr. Obama was flanked by a large retinue of advisers — many of whom had labored on Middle East peace talks in the Clinton administration — as he made his way by motorcade from Jerusalem to the West Bank city of Ramallah, and by helicopter here to the city of Sderot, which has been repeatedly struck by Palestinian rockets fired from nearby Gaza.

Tailed by camera crews, Mr. Obama created something of a spectacle on local television, in newspapers and even among the government ministers who jockeyed to join in the attention. He met with officials on both sides of the conflict, but spent far more time with Israeli leaders than Palestinians, eliciting frustration from some in Ramallah that Jerusalem was consuming too much of his time.

Mr. Obama met with Mr. Abbas and the prime minister of the Palestinian Authority, Salam Fayyad, for one hour — 15 minutes longer than scheduled — at the Muqata, the Palestinian president’s compound. Mr. Obama and Mr. Abbas sat down with a Palestinian flag between them and photographs of the late Palestinian leader Yasir Arafat and of Mr. Abbas himself on the wall behind them.

Saeb Erekat, a senior aide to Mr. Abbas and a senior Palestinian negotiator, said in an interview after the meeting that Mr. Obama seemed to be committed to helping both sides achieve a peace accord and was supportive of pursuing a two-state solution.

“My impression is that he is focused,” Mr. Erekat said. “He believes it is in the American national interest and that time is of the essence. He said he won’t waste any time, and that he’ll be a constructive partner.”

Photo

Yet even as Mr. Obama treaded carefully through the perilous path of the Middle East peace process, he was left to defend a proposal he made a year ago to negotiate with Iran. He said he would “take no options off the table” to persuade that country’s leaders not to develop nuclear weapons.

Advertisement Continue reading the main story

“My whole goal,” he said, “in terms of having tough, serious direct diplomacy is not because I’m naïve about the nature of any of these regimes. I’m not. It is because if we show ourselves willing to talk and to offer carrots and sticks in order to deal with these pressing problems — and if Iran then rejects any overtures of that sort — it puts us in a stronger position to mobilize the international community to ratchet up pressure on Iran.”

Senator John McCain, the presumptive Republican nominee, suggested that Mr. Obama had reversed a position he took a year ago when he said he was willing to meet with Iranian leaders without preconditions. For months, Mr. Obama has struggled to explain consistently about whether — and how — he would sit down with rogue leaders.

Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You will receive emails containing news content , updates and promotions from The New York Times. You may opt-out at any time. You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.

Mr. Obama, who is following an itinerary here similar to one that Mr. McCain took four months ago, avoided overtly criticizing his Republican rival while on foreign soil. For the second day in a row, Mr. Obama raised the prospect that either candidate could win.

“And any American president, whether it’s myself or John McCain, can rest assured that Israel won’t be pressured into something that is going to put them at risk,” Mr. Obama said. “Because they have an obligation to their people.”

Mr. McCain, campaigning in Wilkes-Barre, Pa., talked up his own support of Israel and warned again that Iran posed a clear threat to its security.

Photo

“They are probably in many respects under greater threat than they have been since their independence,” Mr. McCain said, then mentioned, as he frequently does, that Iran’s president, Mahmoud Ahmadinejad, has called for Israel to be “wiped off the map.”

In Sderot, a small city about four miles from Gaza, Mr. Obama toured the same house struck by rocket attack that Mr. McCain did in March. The i town has had nearly 2,000 attacks this year, a point underscored by a pile of spent shells that provided a backdrop to Mr. Obama’s news conference, where he was joined by Mr. Barak and Foreign Minister Tzipi Livni.

Mr. Obama, who shuttled between meetings at the King David Hotel and across the city, also visited the Yad Vashem Holocaust memorial. Wearing a white yarmulke, he rekindled a flame and paused for a few moments of quiet reflection as he laid a wreath on a tomb that contains ashes from Nazi extermination camps.

Later, he received a warm reception from the Israeli president, Shimon Peres, who said his fondest wish was for a “great president of the United States.”

Advertisement Continue reading the main story

“That is the greatest promise for us and the rest of the world,” Mr. Peres said.

Mr. Obama also met with the opposition leader, Benjamin Netanyahu of the rightist Likud Party, who leads in Israeli opinion polls. Given the doubts among some American Jews about Mr. Obama’s position on Israel, the outcome of the meeting with Mr. Netanyahu, a former prime minister who is fluent in American English, was watched closely.

“The main focal point of our discussions was the need to stop Iran from developing nuclear weapons,” Mr. Netanyahu told reporters after the talks, offering a favorable impression of Mr. Obama. “He said he would never seek in any way to compromise Israel’s security, and this would be sacrosanct in his approach to political negotiations.”

As they talked casually, Mr. Netanyahu asked the visiting senator how he was feeling, to which Mr. Obama replied, “I could fall asleep standing up.”