I am a bit surprised that this hasn't been asked yet, but it seems indeed that it has not.
A few days ago, CNN reported:
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.
(I am not certain that CNN first broke this news, but the Guardian has attributed it to them, so I've gone along with that.)
I am not interested here in the political implications. I would like to know, hypothetically, whether it would be possible for a cabinet secretary to be jailed for the misapplication of federal law in the performance of his or her duties, and, if so, under what circumstances. More precisely, I would like to know whether criminal liability could arise, or personal civil liability (I understand that a presidential pardon would have no effect on civil liability).
I hope answers will also address any existing protections with respect to civil or criminal liability (or both). For example, I am familiar with "qualified immunity" in civil rights actions against law enforcement officers, but not in other contexts. Would qualified immunity apply here? Would it apply to criminal liability as well as civil? If not, are there other forms of immunity or other protections that do apply?