Secretary of State John F. Kerry on Wednesday harshly criticized Israeli settlements in the West Bank, saying their growth threatens to destroy the viability of a two-state solution to the Israeli-Palestinian conflict, and that the United States was obliged to allow passage of a U.N. resolution condemning the activity in order to preserve the possibility of peace.

Kerry noted that the number of Israelis living in settlements has grown significantly and that their outposts are extending farther into the West Bank — “in the middle of what, by any reasonable definition, would be the future Palestinian state.”

“No one thinking seriously about peace can ignore the reality of what the settlements pose to that peace,” he said.

Kerry, in the hour-long speech delivered at the State Department, also condemned Palestinian incitement to violence as a barrier to direct negotiations. But his focus was on defending the Obama administration’s policies and highlighting Israel’s actions at a moment of high tension between the two governments, following the passage of the U.N. resolution.

“Regrettably, some seem to believe that the U.S. friendship means the U.S. must accept any policy, regardless of our own interests, our own positions, our own words, our own principles — even after urging again and again that the policy must change,” he said. “Friends need to tell each other the hard truths, and friendships require mutual respect.”

He said the vote at the United Nations was about “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.”

Saying the two-state solution was in “serious jeopardy,” Kerry said Israel would never improve its relations with Arab countries if it precludes the possibility of a separate state for Palestinians.

“If the choice is one state, Israel can either be Jewish or Democratic,” he said. “It cannot be both.”

Some Israeli politicians applauded Kerry’s speech. Former prime minister Ehud Barak tweeted that it was a “Powerful, lucid speech. World & majority in Israel think the same.”

But most Israeli leaders and the political right immediately took umbrage, accusing Kerry of trying to dictate policy to an elected government.

­Israeli Prime Minister Benjamin Netanyahu called the speech “a big disappointment.”

“He deals obsessively with the settlements, he fails to deal with the Palestinian failure to recognize a Jewish state,” Netanyahu said, adding, “If he put the same emphasis on Palestinian incitement and terror that he did on settlements then maybe we will be on the way to peace.”

Kerry acknowledged that his vision is not shared by President-elect Donald Trump.

“President Obama and I know that the incoming administration has signaled that they may take a different path, and even suggested breaking from the long-standing U.S. policies on settlements, Jerusalem — and possibly the two-state solution,” Kerry said. “That is for them to decide — that’s how we work. But we cannot, in good conscience, do nothing, and say nothing, when we see the hope of peace slipping away. This is a time to stand up for what is right.”

Trump has said that he will move the U.S. Embassy to Jerusalem from Tel Aviv, a move freighted with political significance in advance of any settlement, and his nominee to be ambassador to Israel, David M. Friedman, has said Jewish settlements in the West Bank are legal.

About two hours before Kerry started speaking, Trump 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!”

Although he did not mention Netanyahu by name, Kerry addressed head-on the Israeli leader’s assertions that the United States had “colluded” in and “orchestrated” last week’s U.N. resolution affirming that settlement activity in the West Bank and East Jerusalem has “no legal validity and constitutes a flagrant violation under international law and a major obstacle to the achievement of the two-state solution.”

Kerry denied that the United States drafted or promoted the resolution. But he acknowledged that the United States took part in preliminary discussions, as is routine. Kerry said the diplomats told other Security Council members they would oppose a resolution that did not condemn Palestinian incitement to violence. They also said if the text were more “balanced,” it was “possible” the United States would not block it.

Kerry called the current Israeli governing coalition the most right-wing in country’s history and said it is driven by an extremist settler agenda inimical to a two-state agreement.

“The result is that policies of this government, which the prime minister himself just described as ‘more committed to settlements than any in Israel’s history,’ are leading in the opposite direction,” Kerry said. “They’re leading towards one state.”

“The vote in the United Nations was about preserving the two-state solution,” he added. “That’s what we were standing up for.”

Kerry offered six principles that he said would satisfy Israeli security needs and Palestinian aspirations for a homeland. Most have been proven sticking points in previous negotiations — among them, Jerusalem as a mutual capital for two states; normalized relations with Arab states in the region; and financial compensation for Palestinian refugees, along with acknowledgment of their suffering.

Kerry returned from vacation to give his speech, which was being worked on until a few minutes before he walked on stage in the Dean Acheson Auditorium. It was a sign that the administration was still struggling to deal with the political firestorm ignited by the resolution vote. The outrage in the Israeli government has been matched among some members of Congress.

Sen. John McCain (R-Ariz.), chairman of the Senate Armed Services Committee, called Kerry’s speech “at best a pointless tirade in the waning days of an outgoing administration.”

The U.S. abstention has been condemned by several Democrats as well, including
Sen. Charles E. Schumer (N.Y.), who is the party’s incoming leader.

But for Kerry it was a speech that captured the pent-up frustration that has grown in the two years since his nine-month effort to broker a peace agreement collapsed, and his attempts to tamp down Palestinian violence came to nothing.

And Kerry, famous for always sounding a hopeful note, was clearly pessimistic about whether his words would make any difference.

“We can only encourage them to take this path,” he said. “We cannot walk down it for them.”

Eglash reported from Jerusalem. Anne Gearan in Washington contributed to this report.