Donald Trump announced on Monday that he will remove the Secret Service director, Randolph “Tex” Alles, from his position, as one anonymous official described “a near-systematic purge” at the Department of Homeland Security.

In a statement, the White House press secretary, Sarah Sanders, said Alles had “done a great job at the agency over the last two years, and the president was thankful for his more than 40 years of service to the country.

“Mr Alles will be leaving shortly and President Trump has selected James M Murray, a career member of the [Secret Service], to take over as director beginning in May.”

The president’s move against Alles came less than a week after Trump withdrew his Immigration and Customs Enforcement director’s nomination to stay on permanently, and a day after the homeland security secretary Kirstjen Nielsen, who oversaw the Secret Service, was forced to resign.

Alles’ departure stems from a personality conflict within the agency, three officials told the Associated Press, speaking on the condition of anonymity to discuss the personnel matter. The officials said Alles’ departure was unrelated to Nielsen’s resignation, or a security breach at the president’s private club in Florida.

Neither Trump nor the White House has explained the overhaul of DHS – which oversees immigration and border security – but it appears to be linked to the president’s anger over a recent surge in migrants from Central America and his desire to take an increasingly hard line towards border security.

The Republican president made stopping illegal immigration a centerpiece in his run for office in 2016, promising to build a wall on the southern border with Mexico. Trump has said he will make border security a key part of his campaign for re-election in 2020.

Alles,a former Marine general, was recommended to the post by the former White House chief of staff John Kelly. He had been the acting deputy commissioner of Customs and Border Protection.

In a message to the agency’s workforce, Alles insisted he had not been fired, describing the shift as part of an “orderly transition in leadership” across the Department of Homeland Secretary.

“No doubt you have seen media reports regarding my ‘firing.’ I assure you that this is not the case, and in fact was told weeks ago by the administration that transitions in leadership should be expected across the Department of Homeland Security,” Alles said in his message to Secret Service agents.

“The president has directed an orderly transition in leadership for this agency and I intend to abide by that direction,” he said.

In an initial report that said Trump had told the acting chief of staff, Mick Mulvaney, to fire Alles, an unidentified official told CNN: “There is a near-systematic purge happening at the nation’s second-largest national security agency.”

Alles inherited an agency that had been dealing with a series of security and personnel issues. Weeks before he was nominated, a man jumped the White House fence and spent 15 minutes roaming the grounds.

His appointment was set to fulfill the recommendations of a group of former senior government officials who reviewed the Secret Service – which protects the president and other key figures – in 2014 and found that it was an “insular agency” in need of an outsider to lead it. But Alles’ unfamiliarity with the agency led to conflicts, the officials told the AP.

Alles’ forthcoming departure comes at a time of high turnover across the department. .

Last week Trump abruptly withdrew the nomination of Ron Vitiello to lead Ice, saying he wanted to go in a “tougher direction”. Stephen Miller, the immigration hawk and White House senior adviser, played a key part in that move, several news outlets reported.

An empowered Miller is also eyeing the removal of Lee Francis Cissna, according to two officials who spoke to the AP. Cissna is director of US Citizenship and Immigration Services, which runs the legal immigration system.

The Department of Homeland Security’s general counsel, John Mitnick, is expected to depart as well, CBS News reported.

Trump has given Miller the go-ahead to run the administration’s border policy “and he’s executing his plan”, the unnamed official told CNN.