Donald Trump reportedly encouraged agents working at the US-Mexico border to deny asylum seekers entry, an action which would have violated US law.

The president first discussed the idea during an Oval Office meeting on 21 March with senior administration officials.

Those present included Kirstjen Nielsen, who was then secretary for Homeland Security and Pat Cipollone, the White House counsel, according to CNN.

Mercedes Schlapp and Dan Scavino, the president’s advisers, were also present, as was Jared Kushner, Mr Trump’s son-in-law.

Ms Nielsen told the president that barring asylum seekers from the US was against the law.

The official discussed the issue with Mr Cipollone, who confirmed that she was correct.

Under the Immigration and Naturalization Act, people arriving at the border “may apply for asylum”, a right which is reinforced under international law as the US is a signatory to the UN’s 1951 Refugee Convention.

Mr Trump visited border agents in Calexico, a city in California on 5 April.

“We’re full, our system’s full, our country’s full -- can’t come in!” he said during the visit.

“Our country is full, what can you do?” We can’t handle any more, our country is full. Can’t come in, I’m sorry. It’s very simple.”

CNN reported two sources said the president privately told border agents to deny asylum seekers entry to the US.

They said he encouraged them to tell judges who objected to the idea that the US had no room for migrants, but that after Mr Trump departed, the border agents looked to their superiors for guidance.

Officials told the agents to follow the law, adding that they were not being told to deny migrants entry and that if they did so, they would bear personal legal liability.

Following the Oval Office meeting in March the president also ordered Ms Nielsen to close the border in the Texan city of El Paso.

The official criticised the idea, which was eventually abandoned.

It comes days after the president said "frankly, we should get rid of judges", during an extended attack on the country's asylum system.

On Sunday the president announced Ms Nielsen would be leaving her post.

During her tenure the 46-year-old became the face of some of the president’s most controversial immigration policies, including that of separating children from their parents at the border.

In May 2018, it was reported that she drafted a resignation letter after Mr Trump berated her in front of other Cabinet secretaries over the situation at the border.

Kevin McAleenan, the current US Customs and Border Protection Commissioner​, has been appointed Acting Secretary of Homeland Security following Ms Nielsen’s departure