Washington (CNN) President Donald Trump told Customs and Border Protection Commissioner Kevin McAleenan he would grant McAleenan a pardon if he were sent to jail for having border agents block asylum seekers from entering the US in defiance of US law, senior administration officials tell CNN.

Trump reportedly made the comment during a visit to the border at Calexico, California, a week ago. It was not clear if the comment was a joke.

Two officials briefed on the exchange say the President told McAleenan, since named the acting secretary of the Department of Homeland Security, that he "would pardon him if he ever went to jail for denying US entry to migrants," as one of the officials paraphrased.

The White House referred CNN to the Department of Homeland Security. A DHS spokesman told CNN, "At no time has the President indicated, asked, directed or pressured the Acting Secretary to do anything illegal. Nor would the Acting Secretary take actions that are not in accordance with our responsibility to enforce the law."

Trump denied reports he offered pardons in a tweet late Friday night.