Sarah Sanders Sanders has been among the longest-serving senior officials in Trump's administration.

Sarah Sanders, the combative White House press secretary whose tenure was marked by controversy and questions about her credibility, will be leaving after 22 months on the job, President Donald Trump announced Thursday.

The president shared the news of her unexpected departure in a tweet, writing: "After 3 1/2 years, our wonderful Sarah Huckabee Sanders will be leaving the White House at the end of the month and going home to the Great State of Arkansas."

He added: "She is a very special person with extraordinary talents, who has done an incredible job! I hope she decides to run for Governor of Arkansas - she would be fantastic. Sarah, thank you for a job well done!"

Sanders, 36, has been among the longest-serving senior officials in Trump's administration. During her rocky stint as the president's official spokeswoman, Sanders endeared herself to her boss and to his supporters by her staunch defense of him and his remarks. She often amplified Trump's criticism of the news media, pushing back on reporters' questions, sometimes sarcastically.

Sanders made her devotion to the president plain in January when she told an interviewer for the Christian TV network CBN that "God wanted Donald Trump to become president."

But her truthfulness and integrity were called into serious question by special counsel Robert Mueller III's nearly two-year investigation of Russian interference in the 2016 election. Mueller's report cites two occasions in May 2017 where Sanders told reporters that rank-and-file members of the FBI supported Trump's firing of FBI director James Comey. But when asked about this description by investigators, Sanders backed off that charge. She told Mueller's team that the first time she made that statement it was a "slip of the tongue" and that she repeated it later in a press interview and it "was a comment she made 'in the heat of the moment' that was not founded on anything," according to the report.

Sanders' time as press secretary is notable for what she didn't do as much as for what she did. Under her watch, her principal function as press secretary - representing the White House in media briefings - all but ceased to exist. The White House set a record in January for the longest stretch in modern history without a news briefing, 41 days. It then set a record, 42 days, in March, followed by a third streak, reaching 94 days Thursday.

In recent months, Sanders' primary public contact with reporters was on the White House driveway, where she would hold irregular and impromptu "gaggles," usually after appearing on Fox News.

Sanders floated leaving after the midterm elections but decided against it, according to people familiar with her thinking. The president often called Sanders in the morning to discuss news coverage of him, and the two would sometimes speak multiple times throughout the day.

Though she no longer briefed the media, she regularly attended meetings on foreign policy, trade and health care. She was at the table for many meetings with foreign leaders.

The terms of her departure were unclear, though Sanders told staff around 4 pm in her office, according to people with knowledge of her comments, that it was her choice.

Sanders also told aides that she couldn't give a commitment through the campaign because of her family.

Republican Mike Huckabee, Sanders' father, echoed his daughter's criticism of the media, tweeting shortly after Trump announced her resignation: "Well, @realDonaldTrump is losing @PressSec who is a great one and I say that with as much objectivity as Fake News CNN has toward @POTUS."

She joined Trump's presidential campaign as a senior communications adviser in early 2016 after managing the unsuccessful campaign of her father, former Arkansas Gov. Mike Huckabee. She served as a spokesman for Trump during the campaign; he appointed her the top deputy to Trump's first press secretary, Sean Spicer, and she replaced Spicer after he resigned in July of 2017.

As such, she was a familiar presence in a White House beset by personnel turmoil and turnover. Trump has had seven communications directors during Sanders' term.

In contrast to Spicer, who could grow visibly agitated under press questioning, Sanders initially drew praise from White House reporters for her calm and friendly manner. But reporters became less enamored of her tendency to skirt questions on sensitive topics by offering rote answers, such as "I haven't spoken with the president about that" or offering to follow up later, only to neglect to do so.

Early in the administration, Sanders showed her mettle when a group of White House aides were gathered in then-press secretary Sean Spicer's office to discuss leaks to the media.

Stephen Bannon, then a senior White House adviser, defended a group of his loyalists who had been accused of the leaks. These young aides, Bannon railed, were "warriors" for Trump.

Finally, Sanders had heard enough. She stood from her perch on the couch to look Bannon in the eye and became visibly emotional.

"I'll tell you who the warriors for Trump are," Sanders said, recalled someone in the meeting, speaking anonymously to recall a private conversation. "The warriors are the folks like me who were there from the beginning, and are still fighting for him every day."

Then, she turned and walked out.

Notably, during an event at the White House after announcing her resignation, Trump referred to her as a "warrior."

He also again floated the idea of Sanders running for office - though GOP Gov. Asa Hutchison's term isn't up until 2022 - and invited her to speak.

"It's truly been something I will treasure forever. ... I've loved every minute, even the hard minutes," she said. She teared up when she said the only thing that could compare is being a mom.