White House press secretary Sarah Sanders, a fierce loyalist of U.S. President Donald Trump who evolved into one of his closest advisers, will leave the job at the end of June to return to her home state of Arkansas, Trump announced on Thursday.

Sanders, who has worked with Trump since the early days of his unconventional run for office and became a national public figure in her own right, is the latest in a long line of senior advisers to leave the White House.

The 36-year-old often compared the antics of the press to the behaviour of her three young children and had largely backed Trump's dismissal of the news media as "the enemy of the people."

She called the job "the honour of a lifetime."

"I've loved every minute, even the hard minutes," Sanders said at a White House event, called onstage by Trump to a standing ovation, her voice trembling with emotion. "I have three amazing kids and I'm going to spend a little more time with them."

Trump described Sanders as "a warrior."

"We've been through a lot together, and she's tough, but she's good," he said.

Sanders for governor?

Sanders evolved into a senior adviser and confidante of the president, one who is regularly brought into senior-level meetings.

In announcing her departure on Twitter, Trump suggested Sanders should run for governor of Arkansas, a position once held by her father, Mike Huckabee.

....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! —@realDonaldTrump

Sanders replied to Trump's tweet not long after, expressing her appreciation for the president and the chance to work with him.

I am blessed and forever grateful to <a href="https://twitter.com/realDonaldTrump?ref_src=twsrc%5Etfw">@realDonaldTrump</a> for the opportunity to serve and proud of everything he’s accomplished. I love the President and my job. The most important job I’ll ever have is being a mom to my kids and it’s time for us to go home. Thank you Mr. President! <a href="https://t.co/wHNnq06AMg">https://t.co/wHNnq06AMg</a> —@PressSec

Trump, who has seen almost a complete turnover in his press and communications teams, did not immediately name a replacement.

His first press secretary, Sean Spicer, resigned abruptly after six months, having become the butt of late-night comedy lampoons for his blustery and fact-challenged arguments for Trump.

Sanders had been Spicer's deputy and initially had a less combustive approach with journalists. But her fiery defences of her boss drew criticism.

In 2017, Sanders told reporters she had heard from "countless members of the FBI" who wanted Trump to fire his former FBI director James Comey — an assertion she later cast as a "slip of the tongue" during special counsel Robert Mueller's probe.

She burns facts and then she uses that ash to create a perfect smokey eye. - Comedian Michelle Wolf

Her relationship with the press became particularly strained a year ago, after a comedian hired by the White House Correspondents' Association for its annual dinner mocked her appearance and penchant for spinning the truth as Sanders sat nearby at the head table.

"She burns facts and then she uses that ash to create a perfect smokey eye," comedian Michelle Wolf said.

In the months afterward, she was asked to leave a restaurant in Lexington, Va., because of her association with the Trump administration.

No more daily briefings

Over time, Sanders retreated from the lectern, frustrating reporters by ending the long tradition of daily press briefings. Trump preferred to take questions himself from reporters and command the White House stage, and relegated Sanders and other staff to appearances on television to defend his policies.

Sanders's last press briefing was 94 days ago, but Trump answers questions from reporters on a near-daily basis, including two extended sessions with them on Wednesday.

Sanders became a popular figure at Trump rallies, sought after for selfies by his supporters. In November, at his final rallies ahead of the congressional elections, Trump invited her on stage to speak briefly to the cheering crowds.

Sanders has long been rumoured as a future gubernatorial candidate in Arkansas. The current governor, Republican Asa Hutchinson, began his second and final four-year term in January. The state's next regular gubernatorial election would be in 2022.

"Arkansas is a very red state. The Huckabee name carries a lot of weight there, and if she ran, I can't think of anyone that would have a chance of beating her," said Alice Stewart, a Republican strategist in Washington who is from Arkansas and worked for Huckabee while he was governor, and then on his presidential campaign.

"The Republicans in Arkansas would welcome her back with open arms. They applaud the work she's done."