Nikki Haley departs President Trump’s administration having made inroads with the Republican Party’s emerging populist coalition without sacrificing her reputation among old guard, establishment conservatives.

In avoiding the pitfalls that have befallen other major Republicans walking the party’s Trump divide, the outgoing U.S. ambassador to the United Nations and former South Carolina governor has preserved options for higher office in a future GOP that might look very much the same, or quite different, by the time Trump exits the White House, six or eight years hence.

“Ambassador Haley has some of the best political instincts not just of any person to come out of South Carolina in a long time, but anyone on the American political scene today,” said Bruce Haynes, vice chair of public affairs at Sard Verbinnen in Washington and a veteran of Palmetto State politics.

“Her latest move shows those instincts,” Haynes continued. “In an administration where there have been some embarrassing exits, she’s getting off the stage to thunderous applause and doing it in a way that enhances her political future, as opposed to compromising it.”

[Read: Here are the notable Trump aides who have left the administration]

Haley, 46, is due to step down as U.N. ambassador at about the time her second, four-year term as South Carolina governor was to conclude. The surprise move, announced this month, immediately sparked speculation about Haley’s political future — specifically, does she look in the mirror and see a president.

The short answer is, yes. Haley, the daughter of Indian immigrants, is ambitious and thinks long-term.

She carefully managed her rise from unknown state lawmaker to governor in 2010, correctly gauging the conservative grassroots’ hunger for fresh blood from outside the GOP establishment. Later on, Haley pivoted toward that same establishment, wooing them with a natural, telegenic charisma and decisive, pragmatic leadership under pressure.

With another Republican presidential primary presumably around the corner in the summer and early fall of 2016, Haley was actively preparing to expand her footprint beyond South Carolina and assume a leading role atop the Republican Party post-election — until Trump shocked the world with his surprise victory.

“She is a calculating politician,” said a Republican operative with South Carolina ties who isn’t a fan but grudgingly respects her political skill and accomplishments. “She’s been plotting this for years.”

There’s just the matter of when Haley might run. Trump is a lock to seek re-election in 2020, and victory could position Vice President Mike Pence as his heir apparent in 2024. That could close off any legitimate shot at the Republican presidential nomination for a decade or longer.

Haley’s relative youth works in her favor. The challenge is to remain relevant and current. There’s also the issue of staying fresh. Even some of the most formidable politicians grow stale and out of practice, especially with the rapidly-changing nature of politics in the modern era, if they go to many years between campaigns.

Yet, Haley is the owner of crucial political assets.

She is quitting the Trump administration on good terms with the president and his loyal #MAGA circle, something of a rarity among the several top aides and cabinet members who have departed his government. She also leaves with her reputation largely intact among Republicans who consider themselves “Never Trump” or Trump-skeptical.

Those relationships position Haley to forge the grassroots and establishment connections she would need to mount a viable presidential bid, and roll easier than others might with the direction the party might take in future elections.

“The president is popular among Republicans, and he’ll not only re-nominated, he may well be re-elected. Regardless of whether the president is re-elected, Nikki Haley will certainly be among the party’s brightest stars six years from now," Robert Godfrey, a longtime Haley adviser, said. "You’d be hard-pressed to name anyone with a stronger resume or more political talent, to say nothing of her gifts as a messenger and her capacity to raise money.”

Trump tapped Haley for the U.N. during his presidential transition. It was unexpected. The president prizes loyalty; Haley had endorsed Sen. Marco Rubio, R-Fla., in the presidential primary and was noticeably cool toward Trump during the general election. The president prizes pedigree; Haley’s resume lacked diplomatic or foreign policy experience. (Some political insiders saw the hire as a reward to Trump ally Henry McMaster. Then South Carolina's Republican lieutenant governor, Haley's resignation to become U.N. ambassador advanced him to the governor's mansion.)

She quickly made a name for herself, articulating an American foreign policy that intertwined Trump’s “America First” rhetoric with a version of the post-World War II internationalism that has characterized American foreign policy under both political parties.

Behind the scenes, Haley was working extremely hard and learning on the job. But in front of the camera, and on the floor of the U.N. General Assembly, she appeared smooth and effortless. Despite some hiccups at Turtle Bay and some criticism from inside the administration, colleagues give Haley high marks for her performance.

“I have worked with Ambassador Haley on hostage matters since taking office. She has been truly dedicated to the safe recovery of Americans who are unjustly detained by regimes such as Iran or held hostage by extremist groups,” said Robert O’Brien, special presidential envoy for hostage affairs at the State Department. “Ambassador Haley used her platform at the United Nations to name and shame the captors. She also provided important advice to and comforted the hostages’ families in numerous personal meetings with them.”

Editor's note: Corrects job title for Robert O'Brien