President Trump announced Sunday afternoon that Homeland Security Secretary Kirstjen Nielsen "will be leaving her position" after 16 months in the job.

Trump also announced that U.S. Customs and Border Protection (CBP) Commissioner Kevin McAleenan will replace Nielsen as acting secretary, tweeting: "I have confidence that Kevin will do a great job!"

Nielsen tweeted Sunday evening that she had submitted her resignation and added: "Its [sic] been an honor of a lifetime to serve with the brave men and women of @DHSgov. I could not be prouder of and more humbled by their service, dedication, and commitment to keep our country safe from all threats and hazards." She included an image of a resignation letter to Trump in which she wrote: "Despite our progress in reforming homeland security for a new age, I have determined that it is the right time for me to step aside."

In a subsequent tweet, Nielsen addressed "the brave and dedicated men and women of @DHSgov," saying she was "eternally grateful and proud of what you do each and everyday [sic] to protect our homeland".

"Our missions as a Department are vast and have never been more vital," Nielsen wrote. "You are in the arena- keep up the good fight. Thank you for your sacrifices and those of your families. God bless you and God bless our great country."

Nielsen met with Trump at the White House Sunday amid an ongoing influx of migrants at the U.S.-Mexico border that has been taxing America's immigration system and sparking frustration within the administration. The Associated Press, citing two sources, reported that Nielsen had been frustrated with the difficulty of getting other departments to help deal with the growing number of families crossing the southwestern border.

TRUMP DECLARES 'COUNTRY IS FULL' IN FOX NEWS INTERVIEW, SAYS US CAN NO LONGER ACCEPT ILLEGAL IMMIGRANTS

Administration sources told Fox News Sunday evening that Nielsen's background in cybersecurity made her a poor fit to handle border issues, while McAleenan best fits Trump's requirement of being the "toughest cop" on the frontier.

Nielsen skipped last week's meeting of interior ministers from the Group of Seven countries (G-7) in Paris to deal with the migration crisis, which she compared to the aftermath of a Category 5 hurricane.

She also had taken to social media in recent days, tweeting that Congress must give border and immigration officials the tools and resources needed to "fulfill our humanitarian and security mission."

Nielsen visited El Paso, Texas, on Wednesday, marking her first stop on a border tour aimed at assessing the surge of migrants and the department's response. "Our system and facilities were never structured to withstand the current influx of immigrants," she said.

TRUMP SAYS HE NIXED ICE DIRECTOR NOMINATION, SAYS HE WANTS TO GO 'IN A TOUGHER DIRECTION'

On Friday, Nielsen and Trump participated in a roundtable with border officers and local law enforcement. There she echoed Trump's comments on the situation at the border, though she ducked out of the room without explanation for some time while Trump spoke. As they toured a section of newly rebuilt barriers, Nielsen was at Trump's side, introducing him to local officials. She returned to Washington afterward on a Coast Guard Gulfstream, as Trump continued on a fundraising trip to California and Nevada.

Trump nominated Nielsen as Homeland Security secretary in October 2017, replacing her former boss John Kelly, whom Trump had named White House chief of staff months earlier. She was confirmed by the Senate in December of that year.

Nielsen was viewed as resistant to some of the harshest immigration measures supported by the president and his aides, particularly senior adviser Stephen Miller, both around the border and on other matters like protected status for some refugees. A senior administration official told Fox News Sunday that National Security Adviser John Bolton long felt that Nielsen was not the right person for the job and opposed her policy of using United Nations organizations to try to stem the flow of illegal migrants.

The official added that Bolton and Kelly had a heated disagreement over Nielsen's approach during an October 2018 policy meeting, after which Bolton went to Trump to protest what Nielsen was doing.

Once Kelly left the White House at the end of last year, Nielsen's days appeared to be numbered. She had expected to be pushed out last November, but her exit never materialized. And during the government shutdown over Trump's push for funding for a border wall, Nielsen's stock inside the White House even appeared to rise.

Trump nominated McAleenan as CBP commissioner on the first day of his presidency, but McAleenan was not confirmed by the Senate until March of 2018. He was appointed CBP deputy commissioner in November 2014 by President Barack Obama.

Sources tell Fox News that it remains to be seen whether McAleenan can handle the political duties required to be permanent homeland security secretary, though they noted that he has excellent relationships with the Pentagon, State Department, and National Security Council. McAleenan also has a reputation within CBP as a "brilliant" mind with "tremendous organizational skills."

CLICK HERE TO GET THE FOX NEWS APP

Nielsen's departure is the latest staffing shakeup in the department, which was founded to combat terrorism after the Sept. 11, 2001 attacks.

On Friday, Trump confirmed he had withdrawn the nomination of acting Immigration and Customs Enforcement (ICE) Director Ron Vitiello to become the permanent head of the agency, telling reporters that "Ron’s a good man, but we’re going in a tougher direction, we want to go in a tougher direction." Administration sources tell Fox News that the withdrawal of Vitiello's nomination was the first step in Trump's plan to control the border crisis.

The second step was asking for Nielsen's resignation.

Fox News' John Roberts and The Associated Press contributed to this report.