Paul J. Richards, Getty Images
Rabbi Shmuel Rabinovich stands next to Barack Obama as the presidential candidate places a hand-written prayer inside a crevice in the Western Wall.

JERUSALEM — Democratic presidential contender Barack Obama paid a predawn visit to the holiest place in Judaism today, bowing his head in prayer at the Western Wall.

Obama placed a small note inside a crevice in the ancient wall, a custom observed by many. He made his brief stop as he completed a trip to the Middle East in which he met with Israeli and Palestinian leaders as well as Jordan's King Abdullah II.

Orthodox men at the wall for morning prayers ran down the steps to get a look at Obama. Many reached out to shake his hand, although one booming voice called out, "Obama, Jerusalem is not for sale!"

Obama's visit lasted less than 15 minutes. He was flying to Europe immediately afterward for stops in Germany, France and England before returning home over the weekend.

Earlier in Sderot, Israel, Obama on Wednesday professed "an unshakable commitment to the security" of Israel, whether the threat comes from terrorists, Iran or elsewhere.

"The way you know where somebody's going is where have they been. And I've been with Israel for many, many years now," he said on a day that bore striking similarities to campaigning in the United States.

In his public remarks, Obama sidestepped a question of whether he would condone an Israeli attack to prevent Iran from obtaining a nuclear weapon. But he said he was confident that in several private meetings he had not left Israeli politicians with the impression that, if elected president, he would be "pressuring them to accept any kinds of concessions that would put their security at stake."

Obama packed more than a half-dozen meetings, a stop at the Yad Vashem Holocaust memorial, a helicopter tour of the country and a visit to a house hit by Hamas rockets into his only full day in Israel during his trip to the Middle East and Europe.

He also rode past an Israeli checkpoint into Ramallah on the West Bank, where he assured Palestinian President Mahmoud Abbas of his support for a two-state resolution of the region's long animosities. Later, entering a session with Israeli Prime Minister Ehud Olmert, Obama said his talks with Abbas indicated "there's a strong sense of progress being made" toward peace. Olmert nodded and said, "Indeed."

Obama's major focus was clearly reassuring Israelis — and by extension millions of Jewish voters in the United States — of his commitment to the survival of the Jewish state. He leads his Republican rival, Sen. John McCain of Arizona, among Jewish voters, but his support falls short of what Democrat John Kerry drew four years ago.

Obama said Israelis could be certain of his commitment to Israel's security by looking at "my deeds."

"Just this past week, we passed out of the U.S. Senate Banking Committee, which is my committee, a bill to call for divestment from Iran, as a way of ratcheting up the pressure to ensure that they don't obtain a nuclear weapon," he said.

However, Obama does not serve on the banking committee, and McCain's campaign seized on the mistake.

"Not only is it not his committee, but he's not even on the committee, he didn't vote on the bill, and he had nothing to do with its passage," McCain spokesman Tucker Bounds said in a statement issued Wednesday.

Obama's trip is financed by his presidential campaign, and he flew to Israel from Jordan on Tuesday night about his chartered Boeing 757 emblazoned with his trademark slogan, "Change We Can Believe In."

If his campaign aides were looking for memorable images during the day, they got them, from Obama donning a skullcap at the Holocaust memorial, to President Shimon Peres saying, "God Bless You" outside his official residence, to a stop at a house under reconstruction in Sderot where he saw firsthand the destruction caused by Hamas rockets.

"People are committed," he said, making a fist and thumping his chest three times.

Shielded by intense U.S. and Israeli security, he then traveled a short distance to the local police station. There, Defense Minister Ehud Barak, Foreign Minister Tzipi Livni and local officials showed him racks filled with debris from Hamas rockets that have landed in Sderot in the past seven years. In 2005 Israel withdrew from the Gaza Strip a mile away.

The same racks formed a made-for-television backdrop for a news conference attended not only by U.S. reporters, but also Israelis whose satellite trucks jammed the parking lot across the street.

Eli Moyal, the local mayor, gave Obama a souvenir T-shirt — merely the latest he has received since he began running for president — and the senator also came away with a gift of a piece of rocket as artwork, attached to a wooden plaque.

Gaza Hamas official Fawzi Barhoum had a less-favorable response to Obama's visit to Sderot:

"Hamas considers the remarks of the Democratic candidate today to be part of the American policy of bias towards Israel and giving legitimacy to Israeli crimes against our people. His remarks today give cover for the occupation's nonstop crimes against our people."

The subject of Tehran's presumed drive to gain a nuclear weapon — and the threat that would pose to Israel — was a recurrent theme throughout the day.

The American presidential candidate said, "Iranians need to understand that whether it's the Bush administration or an Obama administration, that this is a paramount concern to the United States."

He said he favors both "big sticks and carrots" to persuade Iranians to switch course.

"What I have also said, though, is that I will take no options off the table in dealing with this potential Iranian threat. And understand part of my reasoning here.

"A nuclear Iran would be a game-changing situation, not just in the Middle East but around the world. Whatever remains of our nuclear nonproliferation framework, I think, would begin to disintegrate. You would have countries in the Middle East who would see the potential need to also obtain nuclear weapons."

At his news conference, Obama brushed aside a question of whether he had backed off his statement this spring that Jerusalem should be the undivided capital of Israel. Palestinians also lay claim to the city as the capital for any state they establish as the result of peace talks, and the two sides have agreed that the final decision is to be negotiated.

Criticized by Abbas after he made that comment, Obama subsequently amended it. "Well, obviously, it's going to be up to the parties to negotiate a range of these issues. And Jerusalem will be part of those negotiations," he said. He added that "as a practical matter, it would be very difficult to execute" a division of the city.

Abbas issued a statement saying he and Obama had not discussed the issue in their hour together.

Asked by an Israeli reporter about the matter, Obama said, "I continued to say that Jerusalem will be the capital of Israel. And I have said that before and I will say it again. And I also have said that it is important that we don't simply slice the city in half. But I've also said that that's a final status issue."

Obama departs on Thursday for Germany, where he is scheduled to deliver an outdoor speech before a large crowd. He also has stops planned for France and England before flying back to the United States on Saturday.