Secretary of State John F. Kerry said Wednesday that the United States allowed the passage a U.N. condemnation of Israel’s settlement policies as the only way to preserve a two-state solution on the verge of being destroyed.

In a response to Israeli criticism that the United States has abandoned and betrayed its closest ally in the Middle East, Kerry said no U.S. administration has done more for Israel’s security than the current one.

“The vote in the UN was about preserving the two state solution,” said Kerry, speaking from the State Department’s Dean Acheson Auditorium. “That’s what we were standing up for: Israel’s future as a Jewish and democratic state, living side by side in peace and security with its neighbors. That’s what we are trying to preserve, for our sake and for theirs.”

Kerry’s speech aimed to address some of the issues that have contributed to a toxic atmosphere between the Israeli government and the Obama administration — even though Obama approved military aid for Israel worth $38 billion over 10 years, the largest of its kind in U.S. history.

President Obama and Israeli Prime Minister Benjamin Netanyahu initially clashed over the Iran nuclear deal, as Netanyahu aggressively lobbied Congress to reject what he saw as an existential threat to the Jewish state. The emotional issue of Israeli settlements is the latest flashpoint after the U.N. Security Council passed a resolution last week condemning settlements in both the West Bank and East Jerusalem as an obstacle to peace. The United States abstained, rather than exercising its veto, so it passed on a 14-0 vote.

The United Nations has a history of considering resolutions critical of Israel, even more than have been applied to rogue states like North Korea, and Israelis consider it a hostile forum.

Since the latest resolution passed Friday, the Israeli government has accused the Obama administration of orchestrating the measure with other countries in a betrayal of the U.S.-Israel relationship. It has claimed to have “ironclad” proof provided by Arab states of what it called “collusion,” and said it will pass the information along to the incoming administration of President-elect Donald Trump when he takes office in three weeks.

About 90 minutes before Kerry started speaking, Trump, who has said his administration will adopt a different attitude toward Israel and its concerns, tweeted his criticism of the Obama administration:

“We cannot continue to let Israel be treated with such total disdain and disrespect. They used to have a great friend in the U.S., but…….not anymore. The beginning of the end was the horrible Iran deal, and now this (U.N.)! Stay strong Israel, January 20th is fast approaching!”

Netanyahu in turn promptly tweeted his gratitude: “President-elect Trump, thank you for your warm friendship and your clear-cut support for Israel!”

The Obama administration has denied the allegations of collusion, labeling some of the purported evidence “pure fiction.” U.S. officials say they acted to avert the imperiled two-state solution. Critics of settlements say population growth has accelerated since Kerry’s attempt to broker peace talks collapsed in 2014. U.S. officials say settler development in the West Bank makes it much more difficult to divide contested land to accommodate two independent states, one for Israelis and one for Palestinians.

In an effort to dispel the notion the U.S. abstention was a break in policy, the White House has released a list of 47 other Security Council resolutions that have passed in virtually every U.S. administration since 1967. They are related to the conflict, settlements, the status of Jerusalem and other issues. All passed with the United States either abstaining, or in some cases voting in favor of them.

With his days as the nation’s top diplomat dwindling, Kerry views his speech as a last chance to lay out a vision that he would like to form a framework for talks if they ever resume.