The U.S. ambassador to the United Nations is out of an administration where she was always an awkward fit.

Nikki Haley is a free trader. Her boss, Donald Trump, prefers trade wars. Haley, a former South Carolina governor, once mused proudly about a trade mission to India, “the country of my parents’ birth,” and emerged with a positive-sum vision of America’s global role. Trump is an immigration restrictionist with a global perspective so pugilistic that last year he shoved a NATO ally out of his way at a summit showcasing transatlantic unity.

Haley, as first reported by Axios, resigned from the Trump administration on Tuesday. It’s not clear why she’s leaving now, but Haley, who is said to be politically ambitious, is the rare senior Trump official who’s leaving with her reputation as a foreign-policy leader enhanced. She stands in stark contrast to Rex Tillerson, the secretary of state whom Trump so thoroughly humiliated he grew emotional in his farewell address, and H.R. McMaster, the national security adviser who compromised his integrity for Trump and still got fired.

“It’s a great day in the United States and I’m proud to have been part of the team,” Haley said at the White House Tuesday, explaining her timing only with “I’m a believer in term limits”—and denying that she’ll run for president in 2020. “It’s just very important for government officials to understand when it’s time to step aside. I’ve given it everything I got,” said Haley, who will stay on until the end of the year.

But according to a source close to Haley familiar with the resignation, Haley’s discomfort with Trump’s foreign policy reached a point of untenability.

One of the U.S. ambassador to the U.N.’s biggest formal jobs is shepherding the U.S. through the annual United Nations General Assembly in September, one of the most important diplomatic set-piece meetings on the geopolitical calendar. This year, it resulted in Trump getting laughed at during his second consecutive bellicose and hyper-nationalist address. Haley was left to spin that the world “love[s] how honest he is” and take shots at the media for accurately reporting that the assembled diplomats and leaders were mocking the president.

A much-hyped Security Council session chaired by Trump—until he left, with Haley presiding in his absence—saw Haley softening its agenda, from Iran to generic counterproliferation, and yielding neither unity nor deliverables on either. The session is more likely to be remembered for Trump giving an evidence-free accusation that China is interfering in U.S. congressional elections as vengeance for Trump’s tariffs, which the Chinese foreign minister rejected.

Haley’s discontinuities with the rest of the Trump team were on display during a press conference during the General Assembly. While new national security adviser John Bolton sounded Trumpian notes about defending American sovereignty and new Secretary of State Mike Pompeo fielded questions about North Korea, Russia, and Iran, Haley all but sighed at the difficulties that signature Trump policies had posed for her.

“It’s been an interesting time,” Haley said of a forthcoming meeting between Trump and Secretary General António Guterres. Since their last meeting, “we have pulled out of the Paris Accord. We have pulled out of the Global Compact [on migration]. We have pulled out of the Iran deal. And all of that is to say that the United States is determined to obviously be involved in multilateral organizations where we see it, but not in the way that they’re mandated on what the United States does or that infringes on the American people.”

Haley might have also mentioned that she pulled the U.S. out of the United Nations Human Rights Council, a longstanding conservative punching bag, which she called a “hypocritical and self-serving organization that makes a mockery of human rights” in July. But Haley tried to assure the world that it wasn’t “a retreat from human rights commitments.”

And in her resignation remarks, Haley singled out the “genius” Jared Kushner for praise, alongside presidential daughter Ivanka Trump—but, conspicuously, not Pompeo or Bolton.

Yet Haley put her stamp on Trump’s foreign policy. Principally, she won big accolades from inside the administration for securing a unanimous Security Council resolution last year on new petroleum sanctions on North Korea. Trump, in saluting Haley, hailed U.N. “votes that we would normally get no votes, we’re getting strong votes now.” There’s no word yet on Haley’s successor.

The source familiar with Haley’s resignation said that the General Assembly fiascoes last month underscored the difficulty of Haley doing her job. While Haley at the White House denied any talk of her challenging Trump for the Republican presidential nomination in two years, she entered as a rising GOP star with no foreign-policy experience, and is leaving as a known quantity to leaders across the world. The source said of Haley: “She’s thinking long term.”