President Barack Obama delivered an impassioned appeal Thursday for Israel to recognize that compromise will be necessary to achieve lasting security and to take steps to reverse an “undertow” of international isolation that is worsened by its failure to make peace with the Palestinians. Militants again underscored Israel’s vulnerability by firing rockets into a southern border town.

Obama declared anew that Israeli expansion of housing settlements in disputed territory only hinders chances for fruitful negotiations with the Palestinians, but he did not say as he has in the past that they must be halted.

Reminding an audience of Israeli university students that the United States is their country’s best friend and most important ally, Obama said the U.S. will never back down on its commitment to Israel’s defense, particularly against threats such as the one posed by Iran and its nuclear program.

“As long as there is a United States of America, you are not alone,” he told a packed audience of university students who erupted frequently with applause and standing ovations at Jerusalem’s convention center.

The applause continued even as Obama stressed that Israel must make peace with the Palestinians if it is to ensure its survival and long-term viability as a homeland for the Jewish people. Israeli occupation of areas the Palestinians claim for their own state must end, and progress toward creating that Palestinian state will help Israel’s relations with the rest of the world, notably in its Arab-dominated neighborhood, he said.

“Given the frustration in the international community, Israel must reverse an undertow of isolation,” he said. Whereas once Israel could feel at ease by keeping good relations with Arab autocrats, the revolutions sweeping the Middle East and North Africa have made broader outreach, especially on the Palestinian issue, an imperative, he added.

“Just as Israelis built a state in their homeland, Palestinians have a right to be a free people in their own land,” Obama said. “The Palestinian people’s right to self-determination and their justice must also be recognized. Put yourself in their shoes, look at the world through their eyes. It is not fair that a Palestinian child cannot grow up in a state of her own, living their entire lives with the presence of a foreign army that controls the movements … every single day.”

He said its people should understand that specific actions, notably ongoing construction of Jewish housing on disputed territory, hurt the chances for restarting stalled peace talks with the Palestinians, who have made a halt to such building a demand for returning to negotiations.

“Israelis must recognize that continued settlement activity is counterproductive to the cause of peace, and that an independent Palestine must be viable with real borders that have to be drawn,” he said. “No single step is going to erase years of history and propaganda, but progress with the Palestinians is a powerful way to begin, while sidelining extremists who thrive on conflict and thrive on division. It would make a difference.”

Earlier Thursday in the West Bank, standing alongside Palestinian President Mahmoud Abbas, Obama made similar comments and condemned the firing of two rockets on the southern Israeli town of Sderot by militants in Gaza. But, he essentially abandoned previous support for the Palestinian demand that settlement activity end before talks resume.

Abbas and other Palestinian officials said they would not drop the demand, noting that much of the world considers the settlements to be illegal and not merely an impediment to peace talks.