(CNN) Kirstjen Nielsen, the secretary of Homeland Security who has become a face of President Donald Trump's hardline immigration push, is leaving the administration, President Donald Trump announced on Twitter Sunday afternoon.

"Secretary of Homeland Security Kirstjen Nielsen will be leaving her position, and I would like to thank her for her service," Trump said on Twitter.

"I am pleased to announce that Kevin McAleenan, the current U.S. Customs and Border Protection Commissioner, will become Acting Secretary for @DHSgov. I have confidence that Kevin will do a great job!" Trump continued.

Secretary of Homeland Security Kirstjen Nielsen will be leaving her position, and I would like to thank her for her service....

Nielsen did not resign willingly, a person close to her told CNN, but was under pressure to do so. Nielsen did not fight nor grovel to keep her job, the source said. Nielsen should be staying for a week of transition, another White House official said.

McAleenan is a holdover from the Obama administration. He was sworn in on March 20, 2018, as commissioner of US Customs and Border Protection. He is expected to serve as the acting secretary "in the short term," meaning he is not expected to be in the position for the long term, according to a White House official.

Senior administration officials told CNN that Nielsen had a 5 p.m., meeting at the White House with Trump where she was planning to discuss with him the immigration and border issues and a path forward. She had no intention of resigning, according to one of the sources, but rather was going there with an agenda.

Trump had grown increasingly frustrated with the situation at the border, which has seen an influx in migrants, predominantly from Northern Triangle countries.

In California on Friday, a senior administration official tells CNN, Trump told border agents he wanted them to stop letting people cross the border, despite the fact that Central American asylum seekers according to US law can do so.

Nielsen "believed the situation was becoming untenable with the President becoming increasingly unhinged about the border crisis and making unreasonable and even impossible requests," a senior administration official tells CNN.

"I hereby resign from the position of Secretary of the U.S. Department of Homeland Security (DHS), effective April 7th 2019," Nielsen wrote in her resignation letter. "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."

Nielsen later tweeted that she "agreed to stay on as Secretary through Wednesday, April 10th to assist with an orderly transition and ensure that key DHS missions are not impacted."

Removing Nielsen and installing McAleenan as acting secretary presents issues for the line of succession. Putting McAleenan in charge skips over acting Deputy Secretary Claire Grady, who also serves in the Senate confirmed role as the Undersecretary of Management, which raises questions about her future. A senior administration official told CNN that legally Grady is next in line and will have to go in order for McAleenan to assume the role of acting secretary. Another official, asked about this question, told CNN there are issues that need to be addressed before McAleenan can take over.

In a series of tweets, Nielsen said, "it has been an honor of a lifetime to serve with the brave men and women" of DHS and repeated what she also said in her resignation letter that she "could not be prouder of and more humbled by their service."

Nielsen has felt "in limbo" for the last week, a person close to her says, as she bore the brunt of the President's anger over the border.

She's been increasingly on thin ice in the eyes of the President. She did not realize how dire it was when she left the US last weekend, but quickly did, as she abruptly returned.

She did interviews -- including on CNN -- to try and improve the President's souring view of her, the source close to Nielsen said, but to little avail.

"Nothing she could do or say could change how the President started viewing her," the source close to Nielsen said.

That said, she was prepared to be fired at any moment, but did not know going into Sunday's meeting it would be imminent.

Democrats immediately reacted to the news.

"Hampered by misstep after misstep, Kirstjen Nielsen's tenure at the Department of Homeland Security was a disaster from the start. It is clearer now than ever that the Trump Administration's border security and immigration policies - that she enacted and helped craft - have been an abysmal failure and have helped create the humanitarian crisis at the border," said House Homeland Security Committee Chairman Bennie Thompson in a statement.

Rep. Mike Rogers of Alabama, the top Republican on the House Homeland Security Committee, acknowledged Nielsen's challenges in a statement and expressed confidence in McAleenan and whomever the President nominated later.

"Secretary Nielsen served her country honorably as Homeland Security Secretary, despite facing numerous challenges including dire conditions at our southwest border," Rogers said. "Although Commissioner McAleenan will have his work cut out for him, I am confident the department is in capable hands. I look forward to working with McAleenan in his new role and to learning who the president intends to nominate on a permanent basis."

Tumultuous tenure

The departure comes just days after Trump suddenly withdrew the nomination of Ron Vitiello for Immigration and Customs Enforcement director , blindsiding the Department of Homeland Security and the Hill. Nielsen was unaware what was happening until after the nomination had been pulled, a person familiar with the news said. The announcement Sunday also follows plans to cut aid to some Central American countries , marking a sudden reversal after Nielsen had days earlier visited Honduras to sign a regional compact agreement with Honduras, El Salvador and Guatemala.

Nielsen has had a tumultuous tenure that saw Trump steadily ramping up pressure on his team to execute his immigration promises, which he believes is the single driving issue for his base of political supporters.

Trump has vented privately that Nielsen hasn't adequately secured the border or enacted stricter immigration rules, even as she became the face of policies that administration critics called heartless and illegal.

In recent weeks, administration officials have been sounding the alarm over the increase in migrants at the southern border, underscoring the change in demographics as one of the reasons for the host of challenges they're facing. McAleenan said late last month that the US was on pace to encounter more than 100,000 migrants in March alone, making it "the highest month since 2008."

"Right now, we have an emergency on our hands. We need to treat it as such," Nielsen told Chris Cuomo on CNN's "Cuomo Prime Time" Thursday. Nielsen, who served in President George W. Bush's administration, never overcame internal skepticism about her allegiance to Trump. She joined the administration as chief of staff to John Kelly, who was Trump's first Homeland Security secretary.

When Kelly moved to the West Wing as chief of staff, Nielsen followed, becoming a deputy chief of staff tasked with helping Kelly bring rigor to a freewheeling staff.

The role didn't gain her popularity, but it helped her gain enough of Trump's trust to elevate her to the Cabinet post.

But at the agency that oversees border protection and immigration matters -- Trump's signature issue -- it was inevitable Nielsen would find herself in the President's crosshairs.

After a previous Cabinet meeting during which Trump berated her for not acting strongly enough on preventing illegal immigration, Nielsen considered resigning, people familiar with the matter said at the time.

She didn't then and went on to become one of the public faces of a controversial policy that separated families at the southern border.

House Speaker Nancy Pelosi released a statement on Nielsen's resignation, saying, "It is deeply alarming that the Trump Administration official who put children in cages is reportedly resigning because she is not extreme enough for the White House's liking."

Pelosi went on to say, "The President's dangerous and cruel anti-immigrant policies have only worsened the humanitarian suffering at the border and inflicted vast suffering on the families who have been torn apart."

The President posted on Twitter shortly after announcing Nielsen's departure that the "Country is FULL!" and wrote there have been more apprehensions at the southern border "than in many years." He called on Congress to "fix loopholes" and reiterated his threat to close the border.

This story has been updated with additional developments Monday.