WASHINGTON - President Donald Trump has has told advisers he has decided to remove Homeland Security Secretary Kirstjen Nielsen, and her departure from the administration is likely to occur in the coming weeks, if not sooner, according to five current and former White House officials.

Trump canceled a planned trip with Nielsen this week to visit U.S. troops at the border in south Texas and told aides over the weekend he wants her out as soon as possible, these officials said. The president has grumbled for months about what he views as Nielsen’s lackluster performance on immigration enforcement and is believed to be looking for a replacement who will implement his policy ideas with more alacrity.

The announcement could come as soon as this week, three of these officials said.

Trump has changed his mind on key personnel decisions before, and Chief of Staff John Kelly is fighting Nielsen’s pending dismissal and attempting to postpone it, aides say. But Kelly’s future in the administration also is shaky, according to three White House officials.

A spokesman for the Department of Homeland Security declined to comment on Nielsen’s potential departure.

Nielsen has been reluctant to leave the administration before reaching the one-year mark as secretary on Dec. 6, but she has been unhappy in the job for several months, according to colleagues. Trump has berated her during Cabinet meetings, belittled her to other White House staff and tagged her months ago as a “Bushie,” a reference to her previous service under president George W. Bush and meant to cast suspicion on her loyalty.

When Nielsen has tried to explain the laws and regulations that prevent the government from drastically curtailing immigration or closing the border with Mexico, as Trump has suggested, the president has grown impatient and frustrated, aides said.

Nielsen’s departure would leave a leadership void at the government’s third-largest agency, which has 240,000 employees and a $60 billion budget. The deputy secretary job at DHS has been vacant since February, and the White House has not submitted to Congress a nomination for that post.

Unless Trump were to name another official to lead DHS in an acting capacity, the day-to-day task of running the agency would fall to Claire Grady, the undersecretary for management.

Trump has told White House officials he has begun contemplating replacements for Nielsen. He could name one of the agency’s other Senate-confirmed principals, such as Kevin McAleenan, the commissioner of U.S. Customs and Border Protection, or David Pekoske, administrator of the Transportation Security Administration and a former vice commandant of the Coast Guard.

“If I were advising the White House I’d encourage them to nominate someone with executive branch experience,” said one senior DHS official who spoke on the condition of anonymity to share candid views about his agency’s leadership. “This will be our fourth secretary in two years. The last thing we want is someone who needs hand-holding.”

Kris Kobach’s loss in the Kansas governor’s race has generated speculation that Trump could attempt to nominate him as a replacement for Nielsen, but Kobach, Kansas’ secretary of state, remains a polarizing figure whose hard-line views - especially on immigration - are considered by many observers to be too extreme to win Senate confirmation.

Colleagues who’ve worked closely with Nielsen and defend her performance at DHS say working for Trump on immigration issues is miserable because the president has an unrealistic view of border security and little patience for the intricacies of U.S. immigration law.

Nielsen was selected for the DHS job by Kelly, and her imminent departure is another indication that his influence over staff and personnel decisions has waned. Kelly has defended her repeatedly, and aides have grown annoyed at their close relationship - he often praises her impromptu in senior staff meetings while not praising other Cabinet members.

Former colleagues who worked with Nielsen were astonished when Kelly pushed to install her at DHS because she had never led a large organization, let alone one with so many responsibilities. Nielsen worked on disaster-management response in the Bush White House, then in the private sector and academia as a cyber security expert before returning to DHS to work as chief of staff under Kelly when he was Homeland Security secretary during Trump’s first six months in office.

But it was immigration enforcement that became one of Trump’s biggest frustrations, and the president has blamed her for a rebound this year in the number of people arrested along the Mexico border.

At the peak of controversy over the Trump administration’s “zero tolerance” family-separation initiative, Nielsen nonetheless stood at the White House lectern and delivered a vigorous defense of the measures. The president loved her performance - especially when she said there was no administration policy on separations. Days later, under withering criticism, the president changed his mind and ordered an end to the separations.