President Trump speaks during a meeting on African American History Month in the Roosevelt Room of the White House in February 2017. From left are Omarosa Manigault, Trump, Housing and Urban Development Secretary Ben Carson and Lynne Patton. (Evan Vucci/AP)

Just three weeks into the Trump presidency, Lynne Patton, a longtime Trump family aide and freshly minted senior adviser at the Department of Housing and Urban Development, had a personnel problem she deemed serious enough to invoke her powerful connections.

In a flurry of emails to the Office of Presidential Personnel in February 2017, Patton sought to remove Maren Kasper, the White House’s HUD liaison, because Patton felt undermined.

“Dr. Carson & his team deem her divisive and disruptive, as do I,” Patton wrote to John DeStefano, assistant to Trump and then director of presidential personnel, and his deputy director, Sean Doocey, on Feb. 8. “If it helps, Eric Trump agrees that it’s best to nip this potential problem in the bud & told me to call Jared [Kushner], if necessary, but I prefer to go through you all first.”

The emails were obtained by the liberal watchdog group American Oversight through a public records request. The 504-page response was shared with The Washington Post.

The correspondence about Kasper highlighted the extent to which top Trump officials scrutinized their appointees’ personal loyalties in the early days of the administration. In several emails, which took place before HUD Secretary Ben Carson was confirmed, Patton and White House officials discussed their colleagues' support for Trump.

Patton wrote in another email that Carson’s team was “dismayed by the pace of [Kasper’s] removal” and suggested that the White House or Kushner, Trump’s son-in-law and senior adviser, tell Kasper that “ ‘she’s done such a great job laying the ground work at HUD that Labor (or whatever) permanently needs her talents there now.’ Thoughts?

"The less drama, the better.”

Twenty-four hours later, Patton followed up: “This is effectively Code Red status now.”

Patton wrote in a Feb. 9 email, using her own brackets for dramatic effect, that Kasper had expressed anti-Trump opinions and had advised another member of the HUD transition team to stay with the agency for the duration of Trump’s first term instead of joining his reelection team.

“She told a beachhead member who expressed her desire to rejoin the campaign again in 2 years not to bother," Patton wrote. "That she’d be better off staying at HUD for 4 since he won’t win a second term. [insert eye roll]”

Patton, in other emails that day, said that Carson’s deputy chief of staff, Shermichael Singleton, was threatening to leave if Kasper wasn’t transferred by the end of the day — or the following morning, at the latest.

“I know Carson prefers to have both him & me here in lieu of her,” Patton wrote, after Doocey responded with a link to an October 2016 op-ed by Singleton for the Hill in which he wrote that Trump is “unfit to be president and undeserving to represent the Republican Party.”

Patton, who now oversees HUD’s New York and New Jersey region, said Monday that Eric Trump never inserted himself into HUD personnel matters and that she did not attempt to contact Kushner about her problems with Kasper.

“The early days of this administration experienced many learning curves and I was no exception,” Patton said. “Eric made it very clear to me not to involve him in any government issues and to go through proper channels. It was wrong of me to misspeak.”

Eric Trump declined a request for comment, and the emails show no evidence that he took any action. Kasper did not respond to a request for comment.

As it turned out, Kasper was not immediately transferred.

On Feb. 11, 2017, Patton sent an email to the White House apologizing for what she characterized as a “misunderstanding” about Carson’s wishes. The White House had been prepared to move Kasper, but Carson, who had never advocated for Kasper’s removal, intervened, Patton told The Post.

Instead, Singleton was fired on Feb. 15, 2017, for his earlier writings criticizing Trump, according to media reports at the time. Kasper, who Patton says she now admires, was transferred to the Government National Mortgage Association in June 2017 to serve as executive vice president.

Singleton, who had worked on Carson’s 2016 presidential campaign, told The Post on Monday that he fully backed Patton’s attempt to remove Kasper.

“My loyalties had to be with Dr. Carson,” Singleton said. “I wanted to make sure he could get through unscathed, and Maren had her own agenda that I thought conflicted with Dr. Carson’s best interests.”

Eric Trump has generally steered clear of federal policy and personnel matters since his father won the presidency. His sister Ivanka Trump and her husband, Kushner, serve as White House advisers.

Eric and his brother, Don Jr., withdrew as honorary co-chairmen for a “Camouflage & Cufflinks” fundraiser connected to the 2017 inauguration after outside groups raised ethics questions about their participation.

Eric’s wife, Lara, has worked on several animal welfare issues over the past two years, meeting with White House officials as well as Cabinet members. She has advocated connecting homeless pets with veterans, preventing wild horses and burros from being euthanized, and enforcing policies related to “puppy mill” operations with greater stringency.