(CNN) The Department of Homeland Security is in the throes of yet another bout of leadership turnover less than a year after officials in the top ranks of the agency were ousted.

On Friday, Kevin McAleenan, who assumed the post of acting Homeland Security Secretary in April, announced his resignation. He was the fourth secretary to serve under the Trump administration.

In the first few hours following the announcement, there was confusion and uncertainty about who would be next in line and the future of the department, a DHS official told CNN. McAleenan is expected to remain on until a replacement is named, another official later said.

A source close to the process told CNN White House officials tried to talk McAleenan, who served as a career official under Presidents George W. Bush and Barack Obama, out of resigning.

In April, the White House's growing frustration with leadership led to the ouster that placed McAleenan at the helm. Since then, many of the leading roles in the department have been filled with people serving in an acting capacity.

"That gets to be pretty discouraging because they don't see pathway to advance, because everything is on hold," said a former DHS official, referring to the workforce.

Despite a turbulent few months, McAleenan's decision to leave was on his own terms, according to a source. A DHS official said, "The departure is a terrible loss for the morale and reputation" of the department.

Acting US Citizenship and Immigration Services Director Ken Cuccinelli has been rumored for months as a possible replacement for McAleenan, but legal experts have doubted whether it would comply with vacancy law and others in the department have questioned whether he would be the right fit for the role.

Transportation Security Administration Administrator David Pekoske has been filling the deputy secretary role at the department since April. Pekoske, who has kept a low profile since joining headquarters, was confirmed by the Senate to lead TSA in August 2017 and has been serving in dual roles. It's unclear if he'll assume the role of acting secretary in the wake of McAleenan's departure.

"(McAleenan) was a well-respected leader within (Customs and Border Protection) and DHS and he will be missed," said an administration official. When asked where this leaves the department, the official replied, "More political."

Humanitarian crisis at US border

During his six-month tenure, McAleenan has had to navigate a migration crisis at the southern border, while leading the third largest federal department in the wake of a management purge that left a number of key positions without permanent leadership.

All three of the department's immigration agencies are also helmed by acting leaders.

"He did an admirable job and deserves a lot of credit for doing the best he could under the circumstances," said John Sandweg, former acting director of Immigration and Customs Enforcement. "He tried to solve a difficult problem with real solutions."

At times, McAleenan was hesitant about the direction of the Trump administration, occasionally voicing his concern. But he also carried out some of its most controversial policies. During his time in office, the department ramped up the return of some migrants to Mexico to await immigration proceedings, rolled out the public charge rule , which makes it more difficult for immigrants who rely on public assistance to obtain legal status and has since been blocked by three federal judges , and implemented nationwide restrictions on asylum claims in the US.

McAleenan was asked to step into the role of acting secretary after the forced resignation of his predecessor Kirstjen Nielsen in April . He was serving as the Senate-confirmed commissioner of Customs and Border Protection. No permanent secretary was nominated, leaving McAleenan to oversee the department at the center of Trump's attention and frustration.

Border apprehensions, extreme overcrowding and allegations of inappropriate behavior

McAleenan's tenure was marked by a spike in US-Mexico border apprehensions, which led to extreme overcrowding and extended stays for migrants in US Border Patrol custody at the southern border. The situation reached a fever pitch this summer, as allegations of inappropriate behavior -- both online and at work -- by Border Patrol agents spilled into public view. Apprehensions have since declined. McAleenan has cited a series of policy changes, including agreements with Northern Triangle countries, as reason for the decline.

Trump's tariff threat against Mexico and freezing of aid funds to Central America "created a window to negotiate that he was able to capitalize on," said a DHS source. "He did as much as he could do. He accomplished an incredible amount as Secretary," added the source.

The President, who prefers leaders to remain in acting capacities, never fully endorsed McAleenan. His relationship with Trump ran hot and cold based on the numbers of migrants crossing the border and headlines the President didn't like, sources previously told CNN.

"Everybody who has read articles over the last couple weeks saw it coming. No one was genuinely shocked, but when it hits, it hits," said a DHS official.

"No one is going to survive four or six years in this administration," added the source.

Last week, The Washington Post published an interview with McAleenan in which he conceded, "What I don't have control over is the tone, the message, the public face and approach of the department in an increasingly polarized time."

"That's uncomfortable, as the accountable, senior figure," he added.

McAleenan was referring to acting Customs and Border Protection Commissioner Mark Morgan and Cuccinelli, according to the Post.

A USCIS official told CNN that McAleenan and Cuccinelli have discussed the fact that they each communicate in different ways, "and that that is a positive for DHS, not a negative."

In June, McAleenan went to the White House prepared to resign , concerned that an immigration operation targeting undocumented families for deportation was half-baked and too far-reaching in scope. He also felt undermined by subordinate immigration hardliners who had a direct line to the President over the issue that Trump cares most about, two sources familiar with the matter said this summer.

McAleenan thought the operation would anger Democrats and jeopardize the administration's request for emergency funding for the border, which he had been desperately advocating for to manage the increasing number of migrant arrivals. The operation was eventually suspended and Congress passed the $4.5 billion emergency border funding bill that McAleenan thought the ICE raids could undermine.

The resignation announcement, which had been planned for weeks, came Friday. Trump would note of McAleenan, "Congratulations Kevin, on a job well done! I will be announcing the new Acting Secretary next week. Many wonderful candidates!"