Updated

Kirstjen Nielsen said Monday she still shares President Donald Trump's goal of securing the border, a day after she resigned as Homeland Security secretary amid Trump's frustration and bitterness over a spike in Central American migration.

Trump announced on Sunday in a tweet that U.S. Customs and Border Protection Commissioner Kevin McAleenan would be taking over as acting head of the department. The decision to name a top immigration officer to the post reflects Trump's priority for the sprawling department founded to combat terrorism following the Sept. 11 attacks.

Nielsen had traveled to the U.S.-Mexico border on Friday with Trump to participate 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 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 as Trump continued on a fundraising trip to California and Nevada.

But on Sunday, she wrote in her resignation letter that "it is the right time for me to step aside." She wrote that she hoped "the next secretary will have the support of Congress and the courts in fixing the laws which have impeded our ability to fully secure America's borders and which have contributed to discord in our nation's discourse."

Nielsen told reporters outside her Alexandria, Virginia home Monday that she continues to support the president's goal of securing the border.

"I will continue to support all efforts to address the humanitarian and security crisis on the border," she said in her first public remarks since the surprise resignation, thanking the president "for the tremendous opportunity to serve this country."

Nielsen had grown increasingly frustrated by what she saw as a lack of support from other departments and increased meddling by Trump aides on difficult immigration issues, according to three people familiar with details of her resignation. They spoke on condition of anonymity because they were not authorized to discuss the matter.

She went into the White House on Sunday to meet with Trump not knowing whether she'd be fired or would resign. She ended up resigning, though she was not forced to do so, they said.

Though Trump aides were eyeing a staff shake-up at the Department of Homeland Security and had already withdrawn the nomination of another key immigration official, the development Sunday was unexpected.

Still, it was unclear how McAleenan would immediately assume the role. The agency's undersecretary of management, Claire Grady, is technically next in line for the job, and she will need to resign — or more likely be fired — in order for McAleenan to assume the post.

"The president works very well with Kevin McAleenan. He's done an incredible job in the administration and we expect that relationship and the work to continue," White House spokesman Hogan Gidley told reporters Monday.

He cited McAleenan's "extensive" knowledge of immigration issues and said the change in leadership would hopefully lead to "massive changes" at the border.

Nielsen is the latest person felled in the Trump administration's unprecedented churn of top staff and Cabinet officials, brought about by the president's mercurial management style, insistence on blind loyalty and rash policy announcements.

She was also the highest profile female Cabinet member, and her exit leaves DHS along with the Pentagon and even the White House staff without permanent heads. Patrick Shanahan has held the post of acting defense secretary since the former secretary, Jim Mattis, was pushed out in December over criticism of the president's Syria withdrawal plans. Acting White House chief of staff Mick Mulvaney has held his post since January, following John Kelly's resignation last year.

McAleenan has helped shape many of the administration's policies to date and is considered highly competent by congressional leaders, the White House and Homeland Security officials. But it's unclear if he can have much more of an effect on the issues at the border. The Trump administration has bumped up against legal restrictions and court rulings that have hamstrung many of its major efforts to remake border security.

Rep. Joaquin Castro, chairman of the Congressional Hispanic Caucus, was critical of Nielsen, saying she spent her tenure "championing President Trump's cruel anti-immigrant agenda," and he called McAleenan's appointment "deeply disturbing."

"He cannot be trusted as Acting DHS Secretary based on his record of prioritizing Trump's harmful policies that undermine national security and the economy, and hurt vulnerable families and children at the border," Castro, a Texas Democrat, said in a statement.

Tensions between the White House and Nielsen have persisted almost from the moment she became secretary, after her predecessor, Kelly, became the White House chief of staff in 2017. 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 on matters around the border and others like protected status for some refugees.

Once Kelly left the White House, Nielsen's days appeared to be numbered, and she had expected to be pushed out last November.

During the government shutdown over Trump's insistence for funding for a border wall, Nielsen's standing inside the White House appeared to rise. But in recent weeks, as a new wave of migration has taxed resources along the border and as Trump sought to regain control of the issue for his 2020 re-election campaign, tensions flared anew.

The final straw came when Trump gave Nielsen no heads-up or opportunity to discuss his decision to pull the nomination of acting Immigration and Customs Enforcement Director Ron Vitiello — a move seen as part of a larger effort by Miller, an immigration hardliner, and his allies at the White House to clean house at the department and bring in more people who share their views, the people said.

Nielsen had wanted to discuss the move with Trump during their visit to the border Friday, but when there was no time, she asked for the meeting Sunday. She walked into it prepared to resign, depending on what she heard. The people described mounting frustrations on both sides, with Trump exasperated at the situation at the border and Nielsen frustrated by White House actions she felt were counterproductive.

Arrests along the southern border have skyrocketed recently. Border agents are on track to make 100,000 arrests and denials of entry at the southern border in March, more than half of which are families with children. A press conference to announce the most recent border numbers — scheduled to be held by McAleenan on Monday — was postponed.

Nielsen dutifully pushed Trump's immigration policies, including funding for his border wall, and defended the administration's practice of separating children from parents. She told a Senate committee that removing children from parents facing criminal charges happens "in the United States every day." But she was also instrumental in ending the policy.

Under Nielsen, migrants seeking asylum are waiting in Mexico as their cases progress. She also moved to abandon longstanding regulations that dictate how long children are allowed to be held in immigration detention and requested bed space from the U.S. military for 12,000 people in an effort to detain all families who cross the border. Right now there is space for about 3,000 families, and facilities are at capacity.

Nielsen also advocated for strong cybersecurity defense and said she believed the next major terror attack would occur online — not by planes or bombs. She was tasked with helping states secure elections following Russian interference during the 2018 election.

She led the federal agency since December 2017 and was this administration's third Homeland Security secretary. A protege of Kelly's, he brought her to the White House after Trump named him chief of staff.

___

Associated Press writers Jill Colvin and Lisa Mascaro contributed to this report.

___

This story corrects the month in which border agents are on track to make 100,000 arrests and denials of entry to March, not this month.