The clash just four weeks before Mr. Obama leaves office culminated a fractious eight years between the men. From the start, the two did not see eye to eye. Idealistic and perhaps overconfident, Mr. Obama arrived in the White House certain that he could be the president who would finally resolve the decades-old dispute between Israelis and Palestinians. But Mr. Netanyahu saw a naïf who failed to grasp the existential threat to Israel and who demanded more of his friends than his enemies.

The relationship was marked by one conflict after another, a reflection of not just personal differences but deeply held and diverging policy objectives of the men and their countries. Mr. Obama’s demand that Israel suspend new settlements to enter negotiations infuriated Mr. Netanyahu. The announcement of new construction in East Jerusalem while Vice President Joseph R. Biden Jr. was visiting infuriated Mr. Obama. Two major pushes for negotiations by Mr. Obama unraveled amid mistrust and animosity.

The multinational deal masterminded by Mr. Obama to curb Iran’s nuclear program in exchange for relief from international sanctions proved a breaking point. At first, Mr. Obama hid the secret talks with Iran from the Israelis. After the talks became public knowledge, Mr. Netanyahu flew to Washington to excoriate the effort in a joint meeting of Congress. But he could not stop it.

The two tried to put the rupture behind them last fall by sealing a 10-year $38 billion American security aid package for Israel, but even then the bitterness of their quarrels hung over the agreement. Mr. Netanyahu’s critics at home asserted that the package should have been $45 billion and that the prime minister’s speech to Congress had come with a $7 billion price tag. American officials said it never would have been that high, but the opposing sides remained scratchy.

Even after the smiles and golf get-together in New York in September, Mr. Obama made it clear that he was not yet done with his efforts to leave his mark on Middle East peace efforts as he considered outlining an American framework for an agreement. Mr. Obama was angered by Mr. Netanyahu’s proposal to save an illegal Israeli outpost in Amona by moving the settlers to another plot of land claimed by the Palestinians.

Mr. Netanyahu’s critics in Israel said the Amona controversy and proposed legislation to legalize other outlaw outposts were responsible for Mr. Obama’s decision to abandon Israel’s government on Friday.

“Netanyahu chose to advance the legalization bill, insisted on Amona and galloped into the wall in full knowledge that this would be the result — while choosing his personal interest over the national interest,” Tzipi Livni, a former foreign minister, wrote on Facebook.