President Obama, while seeking to reassure Israel that America has its back in the face of a nuclear Iran, said Wednesday he believes there's "still time" to resolve the stand-off diplomatically -- as Israeli Prime Minister Benjamin Netanyahu suggested time is running short. 

Both leaders, in a joint press conference on Obama's first trip as president to Israel, stressed that their goal is to prevent Iran from obtaining a nuclear weapon. But the two appeared to diverge on the effectiveness of diplomacy. 

In his opening remarks, Netanyahu said sanctions and diplomacy "so far have not stopped" Iran's ambitions. 

"Diplomacy and sanctions must be augmented by a clear and credible threat of military action," he said. 

Later on, Obama said: "We prefer to resolve this diplomatically, and there is still time to do so." 

Still, he added that "all options are on the table" if diplomacy falls short. "The question is, will Iranian leadership seize that opportunity," he added. The president said Iran's past behavior indicates that "we can't even trust yet, much less verify." 

The meeting, and the two-day swing through Israel, was a chance for both leaders to reaffirm their ties, and for Obama to try and boost his image in the country after avoiding it for the last five years. Though Obama visited as a presidential candidate, this is his first visit to Israel since taking office in 2009. 

In Israel, Obama stopped briefly in Tel Aviv before flying to Jerusalem for meetings with senior leaders including Israeli President Shimon Peres. Peres praised Obama for an "impressive record of answering our needs," and welcomed the message that "no one should let skepticism win the day" when it comes to the peace process. 

Pressed during the press conference with Netanyahu on the lack of progress toward an Israeli-Palestinian peace deal, Obama said he's certain he could have done things differently when it comes to the Mideast. 

But he said bringing peace to the region is "a really hard problem" to solve -- one that's lingered for more than 60 years. Obama also suggested that failure to reach an agreement in his first term between Israelis and Palestinians doesn't mean that he "screwed up somehow." 

The conversation turned repeatedly to the civil war in Syria and Iran's nuclear program. 

Obama started out his remarks with the prime minister by stressing that the security of Israel is "non-negotiable." The president said America's commitment to Israel's security is a "solemn obligation." 

Netanyahu, thanking Obama for his statements, stressed that: "Today we have both the right and the capability to defend ourselves."

Associated Press contributed to this report.