In a move that stunned the international community, as well as her home state of South Carolina, United Nations Ambassador Nikki Haley abruptly resigned her post Tuesday after less than two years on the job.

President Donald Trump accepted her resignation. Haley plans to stay on through the end of the year.

During a joint Oval Office appearance with the president, Haley said she has no plans to challenge him for the White House in 2020, as some had speculated. Many political analysts continue to peg the 46-year-old former South Carolina governor as one of the most formidable GOP prospects in 2024 or beyond.

Trump said Haley first told him of her plans to resign six months ago. Haley's resignation letter is dated Oct. 3.

Trump lavished praise on Haley and lamented her departure.

"She got to know the players. She got to know China, Russia, India. She knows everybody on a very first-name basis. And they like her," Trump said. "And I think maybe more importantly, they respect her."

Friendly foreign heads of state said there would be void in U.S. relations left by Haley's exit.

"I would like to thank Ambassador Nikki Haley, who led the uncompromising struggle against hypocrisy at the UN," said Israeli Prime Minister Benjamin Netanyahu. "You’ve shown that with enough strength and determination, real change is possible.”

Haley was seen as a GOP rising star before she stepped down as governor in 2017 to accept Trump's offer to serve as U.N. ambassador. She was confirmed to the international role four days after his inauguration and has received plaudits as a stabilizing force within his often turbulent administration.

Haley called her service "an honor of a lifetime."

"I'll never truly step aside from fighting for our country," Haley said. She touted achievements that included condemning chemical weapons in Syria, changing NATO and adjusting tariffs.

Why Haley is leaving remains unclear but she cited her support for term limits as one reason.

"I think you have to be selfless enough to know when you step aside and allow someone else to do the job," Haley said.

Haley also tried to quell longstanding rumors that she has presidential aspirations — at least for now.

"No, I am not running for 2020," she said. "I can promise you I will be campaigning for this one," she added, pointing to Trump.

Haley, who has clashed openly with the president at times during her tenure, praised the Trump administration. She called Trump's son-in-law and senior White House adviser Jared Kushner "a hidden genius no one understands."

Haley also called Ivanka Trump "a great friend."

"They do a lot of things behind the scenes that I wish people could see," Haley said. "We're a better country because of the administration."

Reaction to her exit came mostly in the form of praise.

"She is a clear, concise voice for American leadership, American values, and has been a true agent of reform when it came to the United Nations," said U.S. Sen. Lindsey Graham, R-S.C.

U.S. Sen. Tim Scott, R-S.C., called her "a trailblazer."

The news of Haley's impending departure reverberated through social media, shocking many.

House Speaker Paul Ryan tweeted his support of Haley, calling her "a clear, consistent, and powerful voice" for America on the world stage.

Senate Majority Leader Mitch McConnell stated on the Senate floor that he was proud of her "American moral leadership." He also added, "I hope this is not the end" of Haley's time in public service.

Many longtime Haley allies in South Carolina were as surprised as anyone by her decision.

“In my mind, she will be the first female president,” said U.S. Rep. Ralph Norman, R-S.C, who entered the Statehouse along with Haley in 2005. “But this is a shocker.”

Haley's predecessor in the governor's office, U.S. Rep. Mark Sanford, questioned the timing of the announcement.

"This is not typically the kind of thing one would announce before a fairly pivotal set of midterms," said Sanford, R-Charleston. "That leads one to guess if there's another shoe about to drop from the administration's standpoint."

Sanford cited recent news that a Washington watchdog group had called for an investigation into Haley's flights on private jets. Two former members of the Trump administration, EPA Chief Scott Pruitt and Health and Human Services Secretary Tom Price, both resigned this year amid ethical questions about their lavish air travel.

"His job is to smell the political winds," Sanford said of Trump. "And if you look at what happened to Pruitt and Tom Price, the private plane issue proved lethal."

Asked if that complaint factored into Haley's announcement, Trump said he knew nothing about it.

Sign up for updates!

Get the latest political news from The Post and Courier in your inbox.

"I know Nikki," Trump said. "This is one of the most honest human beings you'll ever see."

Haley's resignation announcement also comes shortly after her rotation as president of the United Nations Security Council ended last month.

Experts predicted that foreign diplomats would miss Haley's presence in New York. Richard Gowan, a senior fellow at the UN University Centre for Policy Research, said Haley appreciated the value of a functioning U.N. to America's foreign policy.

"I think Haley will be remembered as an effective ambassador who made real progress on issues like sanctioning North Korea," Gowan said. "She proved critics who lamented her lack of foreign policy experience wrong. She was mainly pragmatic in dealing with other diplomats, although there were flashes of real tension over Israel and Iran."

Before the Tuesday's press conference, Haley's Twitter account already had deleted any mention of her past position in her bio. Only a link to her Instagram account, which also had removed any mention of her tenure at the U.N., remained along with her location in New York.

In a Saturday post on social media, Haley shared a photo of herself in South Carolina with former deputy national security adviser Dina Powell, who some believe could be Haley's successor at the U.N. Later Tuesday, Trump himself confirmed that Powell is a "person I would consider."

Trump said the search for Haley's successor has begun and announcement could occur "within the next two to three weeks, maybe sooner." He noted Haley will be directly involved in picking the next U.S. ambassador to the United Nations.

Trump also said Haley has made the job a desirable one.

"She made it a more glamorous position that it was two years ago," he said. "She made it a more important position."

Haley said she plans to do whatever she can to make sure things are ready for her successor.

In a modified refrain of what became her signature salutation as governor, "It's a great day in South Carolina," Haley told the nation Tuesday, "It's a great day in the United States. And I'm proud to have been part of the team."

Reach Caitlin Byrd at 843-937-5590 and follow her on Twitter @MaryCaitlinByrd.

Political Reporter

Caitlin Byrd is a political reporter at The Post and Courier and author of the Palmetto Politics newsletter. Before moving to Charleston in 2016, her byline appeared in the Asheville Citizen-Times. To date, Byrd has won 17 awards for her work.

Jamie Lovegrove is a political reporter covering the South Carolina statehouse and congressional delegation. He previously covered Texas politics in Washington for The Dallas Morning News and in Austin for the Texas Tribune.