Homeland Security Secretary Kirstjen Nielsen looks on during a press conference at the Mexican Government Office: Hector Vivas/Getty Images

Donald Trump’s secretary of homeland security reportedly came close to quitting after the president berated her in a recent Cabinet meeting about immigration.

Mr Trump was reportedly furious with Secretary Kirstjen Nielsen, who also oversees Immigration and Customs Enforcement, for not doing enough to stop the flow of undocumented immigrants from Mexico.

He lashed out at her in a Cabinet meeting in which he rambled about his administration's failure to secure the border – a promise that formed the backbone of his presidential campaign.

The interaction troubled Ms Neilsen so much that she drafted – but did not submit – a resignation letter, according to the New York Times, which first reported on the meeting.

Neither Ms Neilson nor the White House denied that the outburst had occured. White House press secretary Sarah Sanders said only that Mr Trump was “committed to fixing our broken immigration system and our porous borders”.

Ms Neilson said the president was “rightly frustrated” with existing immigration loopholes and a lack of congressional action.

“I share his frustration," Ms Nielsen said in a statement. "Border security is the most basic and necessary responsibility of a sovereign nation. These are complex issues and I will continue to direct the Department to do all we can to implement the president's security-focused agenda."

A spokesman for the Department of Homeland Security (DHS), however, flatley denied the report, calling it “false”.

"The Secretary is hard at work today on the President's security-focused agenda and supporting the men and women of @DHSgov,” spokesman Tyler Houlton tweeted.

Mr Trump promoted Ms Neilson to homeland security secretary last year, after naming her boss at the department, John Kelly, as his chief of staff. Mr Kelly and Mr Trump have also reportedly butted heads in recent weeks, with the president freezing his chief of staff out of sensitive phone calls and meetings.

Ms Nielsen has been a consistent defender of the president, at one point telling senators she could not remember Mr Trump’s controversial “s***hole countries” remark, which he allegedly made in a meeting she attended.

Story continues

She has largely continued the hardline immigration policies endorsed by Mr Trump and established by Mr Kelly. So far, her department has ended the temporary protected status of hundreds of thousands of immigrants from Central American nations and others, forcing them to return to their home countries.

Still, there have been differences between Mr Trump's "zero tolerance" promises and Ms Neilsen's policies. Last month, the president told Ms Neilsen not to allow any members of an immigrant caravan from Latin America to enter the US. DHS has since allowed several members to apply for asylum.

The secretary also reportedly clashed with Mr Trump on his mandate to separate parents found crossing the border illegally from their children. The president felt Ms Neilsen and other DHS officials were resisting this direction, according to the Times.

Attorney General Jeff Sessions announced last week that the Justice Department would prosecute and separate families caught crossing illegally.

"If you cross the border unlawfully, then we will prosecute you. It's that simple," Mr Sessions said.

The attorney general also reportedly threatened to resign after being berated by Mr Trump last fall.