The acting secretary of the U.S. Department of Homeland Security is exiting, President Donald Trump tweeted Friday evening.

"Kevin McAleenan has done an outstanding job as Acting Secretary of Homeland Security," Trump said on Twitter. "We have worked well together with Border Crossings being way down. Kevin now, after many years in Government, wants to spend more time with his family and go to the private sector...."

...Congratulations Kevin, on a job well done!" Trump tweeted. "I will be announcing the new Acting Secretary next week. Many wonderful candidates!"

A former DHS official close to McAleenan said he resigned on his own and was not forced out. Ken Cuccinelli, acting director of U.S. Citizenship and Immigration Services and a frequent defender of Trump on cable news programs, could be a logical choice as next DHS chief.

On Monday, McAleenan abruptly walked off stage during a speech at a Georgetown University-hosted immigration conference in Washington after demonstrators drowned him out with shouts of "Immigrants are under attack" and "Children are under attack."

DHS oversees immigration enforcement.

McAleenan took over the department after Kirstjen Nielsen was forced out in April, in part because she had refused to reinstate the policy of separating children from their families at the U.S.-Mexico border, officials told NBC News at the time.

Later that month, McAleenan told NBC News' Lester Holt that separating migrant families at the U.S. southern border is "not on the table" because the policy was "not worth it" from an enforcement perspective.

In late July, the ACLU claimed in a court filing that the Trump administration was continuing to separate children from migrant parents at the border despite an official halt to the family separation policy in June 2018.

More than 900 children were separated from their parents since the practice was supposed to have ended, the ACLU said in court papers.

McAleenan was previously the U.S. Customs and Border Protection commissioner and worked at CBP in the Obama administration as deputy commissioner.

In a parting statement Friday, McAleenan thanked Trump for his support and said, "We have made tremendous progress mitigating the border security and humanitarian crisis we faced this year, by reducing unlawful crossings, partnering with governments in the region to counter human smugglers and address the causes of migration, and deploy additional border security resources."

I want to thank the President for the opportunity to serve alongside the men and women of the Department of Homeland Security. With his support, over the last 6 months, we have made tremendous progress mitigating the border security and humanitarian crisis we faced this year... pic.twitter.com/A4rTcZgJKF — Acting Sec. Kevin McAleenan (@DHSMcAleenan) October 12, 2019

House Speaker Nancy Pelosi, D-California, said in a statement that McAleenan facilitated Trump's "anti-family and anti-immigrant agenda."

"The departure of the Acting Homeland Security Secretary is the latest sign of this Administration’s failed leadership, which has worsened the humanitarian situation at the border, injected pain and tragedy into countless lives and done nothing to improve the situation at the border," she said.

"The Administration’s barbaric family separation policy and the appalling conditions facing children and families at the border will leave a dark and enduring stain on our nation for years to come," she continued.

The pro-immigrant group Families Belong Together was also critical of McAleenan's record during his time directing Homeland Security, saying he was complicit in ill treatment of migrant children detained at the border.

"History is not kind to those who oversee human rights abuses, and he will be judged harshly for his complicity in this administration's moral bankruptcy," the group's chair, Jess Morales Rocketto, said in a statement.