As a presidential candidate, Barack Obama promised to embrace America’s allies and extend a hand to its adversaries. As president, he has made remarkable progress in engaging longtime foes, restoring relations with Cuba and negotiating a nuclear deal with Iran. But the same can’t be said for all the country’s traditional friends. Obama certainly strengthened alliances with Western European nations turned off by George W. Bush, and worked closely with other countries to fight ISIS and reduce climate change. But on his watch ties have frayed with several countries previously considered U.S. partners, including Egypt, Israel, the Philippines, Saudi Arabia, and Turkey. The bitter back-and-forth this week between U.S. and Israeli leaders on Israel’s settlement policy is just one illustration of this trend.

These ties have frayed in part because of events outside Obama’s control, such as the Egyptian Revolution and, in the case of the Saudis, the American shale-oil revolution. They’ve frayed because of the emergence in many of these countries of leaders who are personally and ideologically at odds with Obama. But they’ve also frayed because of the unique way in which the Obama administration has treated adversaries and allies. The prevailing logic within the administration appears to go something like this: Adversarial governments don’t want what the U.S. government wants, so constructive relationships with them must initially be based on opportunities for dialogue. Eventually, sustained engagement may help produce or identify areas of convergent interest.

“In light of the Cultural Revolution’s horrors, Nixon’s meeting with Mao appeared inexcusable—and yet it surely helped set China on a path where millions of its citizens have been lifted from poverty and connected to open societies,” Obama declared in accepting the Nobel Peace Prize in 2009. “[W]e must try as best we can to balance isolation and engagement, pressure and incentives.” Such logic helps explain why Obama has said, in reference to the Iran nuclear agreement, that “you don’t make deals like this with your friends,” and why, during a visit to Havana, he emphasized the importance of diplomacy despite his many differences with the Cuban government.

By contrast, Obama seems to believe that the United States and its allies should—in an ideal world, at least—share interests and values. When an ally acts in ways he disapproves of, Obama has been more willing than his recent predecessors to publicly criticize or marginalize it. Often this takes the form of Obama suggesting that while the ally ultimately wants what the U.S. wants, it is going about things the wrong way. Hence Obama’s claim that he and Philippine President Rodrigo Duterte share a desire to crack down on drug trafficking, but that Duterte isn’t doing it “the right way;” or his assertion that steadfast U.S. support for Saudi Arabia against Iran isn’t good for the Saudis, even though they think it is; or his advice, as a “friend and partner of Turkey’s,”  that President Recep Tayyip Erdogan avoid an anti-democratic “overreaction” after a failed coup attempt.

Nowhere has this tendency been more evident than in Obama’s relations with Israel, and specifically his longstanding disagreements with Israeli Prime Minister Benjamin Netanyahu over the nuclear deal with Iran and the construction of Jewish settlements in the West Bank and East Jerusalem. Here, for instance, is how Obama defended the Iran accord last year:

I do not doubt [Netanyahu’s] sincerity. But I believe he is wrong. I believe the facts support this deal. I believe they are in America’s interest and Israel’s interest. And as president of the United States, it would be an abrogation of my constitutional duty to act against my best judgment simply because it causes temporary friction with a dear friend and ally. I do not believe that would be the right thing to do for the United States. I do not believe it would be the right thing to do for Israel.

U.S. Secretary of State John Kerry expressed a similar sentiment this week in a speech on the Israeli-Palestinian conflict. “Friends need to tell each other the hard truths,” Kerry argued, and the hard truth in this case was that Israeli settlements are endangering a two-state peace deal with the Palestinians. That’s why the United States had declined to veto a recent UN resolution condemning Israel’s settlement activities, Kerry explained:

This friend, the United States of America, that has done more to support Israel than any other country, this friend that has blocked countless efforts to delegitimize Israel, cannot be true to our own values—or even the stated democratic values of Israel—and we cannot properly defend and protect Israel, if we allow a viable two-state solution to be destroyed before our own eyes. And that’s the bottom line: The vote in the United Nations was about preserving the two-state solution. 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. In fact, this administration has been Israel’s greatest friend and supporter, with an absolutely unwavering commitment to advancing Israel’s security and protecting its legitimacy.

These critiques of allies’ policies may well be justified, but often they haven’t produced the changes that Obama has sought. The leaders of many of these countries have expressed resentment about the American president telling them what’s in their own best interests. Israel’s settlement construction and the Philippines’ brutal drug war continue apace; Turkey’s president is as authoritarian as ever; Saudi Arabia remains rigidly opposed to Iran.

One possible explanation for this lack of progress is that, when it comes to inevitable disagreements with allies, Obama has occupied a middle ground between the relatively gentle public prodding of his recent predecessors and the unpredictable iconoclasm of Donald Trump.

Trump, like Obama, has at times been quite critical of traditional U.S. allies. But, unlike Obama, Trump doesn’t seem to be especially concerned about allies sharing U.S. values, or to expect allies to broadly share U.S. interests; he wants to partner with Vladimir Putin even though he doesn’t “happen to like [the Russian political] system,” and he routinely accuses U.S. allies of exploiting America’s generosity in pursuit of their own selfish goals. And, unlike Obama, Trump has suggested that he might seriously consider alternatives to these alliance arrangements should his criticisms not be addressed—that the United States could, say, withdraw its security commitments to Japan or NATO countries if they don’t invest more in their own defense. These positions have introduced destabilizing uncertainty into America’s intricate alliance system. But they also played a role in Japan’s prime minister hopping on the first plane to Trump Tower, and NATO’s European members ramping up military spending, shortly after Trump’s election.

Obama, on the other hand, typically pairs his criticism of allies with a restatement of his strong commitment to the alliance. This is the complicated legacy the president leaves behind. He has succeeded in forging deals with hostile nations after decades of estrangement, and emphasized the importance of collaborating with allies to address international challenges, while nevertheless leaving a number of allies feeling estranged. It’s premature to assess Obama’s tenure; the bets he’s placed will take years to pay off. But he leaves office amid signs, however faint, that Trump could be more effective at changing the behavior of some American allies than Obama, who often valued those alliances too much to jeopardize them.