Barack Obama, the US Democratic presidential candidate, has said he backs Israel's decision not to negotiate with the Palestinian group Hamas.
Speaking in the Israeli town of Sderot, which has been hit by rocket attacks from Hamas-controlled Gaza, Obama said the US also supported Israel's right to defend itself "against those who threaten its people".
He also reiterated his position that Jerusalem "will be" the capital of Israel.
But the Illinois senator said that he believed the city to be a "final status issue" that must be decided by negotiation and said he remained committed to a two-state solution to the conflict.
Early on Thursday, Obama concluded his Middle East tour and left for Germany to begin a series of visits to European cities.
The status of Jerusalem remains one of the most contentious parts of any solution to the Middle East conflict.
In June Obama caused anger in the Arab world when he said that Jerusalem should be Israel's undivided capital.
The international community, including the United States, does not recognise Israel's claim that Jerusalem is its undivided capital and Palestinians hope to have East Jerusalem, currently occupied by Israel, as the capital of any future Palestinian state.
Obama also said that he would take "no options off the table" with regards to Iran, saying the country posed a "grave threat".
"A nuclear Iran would be a game-changing situation, not just in the Middle East but around the world," Obama said.
The Illinois senator, who had earlier held talks with Palestinian leaders in the West Bank city of Ramallah,
said that if he was elected he would adopt a policy of "big sticks and big carrots" regarding the Iranian government.
"I would at my time and choosing be willing to meet with any leader if I thought it would promote the national security interest of the United States of America," he said.
Obama travelled from Jerusalem to the West Bank city on Wednesday for talks with Mahmoud Abbas, the Palestinian president, and Salam Fayyad, the prime minister, before heading to Sderot.
Saeb Erakat, a senior aide to Abbas told the AFP news agency that Obama told the Palestinian president that "if he wins the election in the United States he will be a full and positive partner in the peace process and will not lose a single moment in pursuing it".
Mustafa Barghouti, the secretary of the Palestinian Initiative, told Al Jazeera that as the candidate of change, Obama should also bring change to the Middle East.
"He cares a lot about the Jewish vote but it's time to care about the Arab vote and the Muslim vote.
"The whole stability of the Middle East depends on resolving the Palestinian issue."
Later Obama told Ehud Olmert, the Israeli prime minister, that he had an "unshakeable commitment to Israel's security".
Security was tight for Obama's West Bank visit, with helmeted riot police carrying truncheons and rifles lining the access road to the walled compound as he shook hands with an Abbas aide and then entered the building.
The Illinois senator's Middle East tour has been an attempt by the Democratic presidential candidate to bolster his foreign policy credentials ahead of the US's presidential election in November.
The visit is in contrast to John McCain, the Republican presidential candidate, who did not visit the West Bank during his time in the region.
Earlier on Wednesday, while meeting Shimon Peres, the Israeli president, Obama pledged that that as president he would preserve the close ties between the US and Israel, and that Israel's security would be a top priority in his administration.
|Obama travelled to the West Bank, unlike his Republican rival John McCain [AFP]
"I'm here on this trip to reaffirm the special relationship between Israel and the United States and my abiding commitment to Israel's security and my hope that I can serve as an effective partner, whether as a US senator or as president," Obama said.
At Israel's Yad Vashem Holocaust memorial, he laid a wreath, lit a memorial flame, and deemed the place to ultimately be "a place of hope".
He was also due to tour the Western Wall, Judaism's holiest site.
Obama's visit in the West Bank has generated some goodwill, particularly since his Republican rival, John McCain, did not visit the Palestinians during a Middle East trip earlier in the summer.
Nour Odeh, Al Jazeera's corrrespondent in Ramallah, said: "The Bush administration only began to be engaged in the Middle East peace process in November 2007 at Annapolis. That peace process is yet to yield any results and is not expected to conclude with a Palestinian state - as promised - at the end of 2008.
"There were a lot of Palestinian frustrations right before Barack Obama came to Ramallah ... but keep in mind that this visit to the West Bank town is only for 45 minutes. Obama is keeping the better part of his day visiting Israeli officials and concentrating on the very important Jewish vote in the US".