The question was directed to Andrew G. McCabe, the bureau’s deputy director.

Trump abruptly fired the director of the FBI, James B. Comey, in May, and at the time, the president openly discussed the need for any successor to be “loyal,” according to an adviser to the president.

The week that Comey was fired, McCabe met with Trump a handful of times, a person familiar with the meetings said.

It was at one of those meetings that Trump asked McCabe whom he had voted for, another person familiar with the encounters said. McCabe said he had not voted. The exchange was first reported by The Washington Post.

The question was unusually and overtly political for an interview related to a position in the Justice Department, which is supposed to maintain its independence from politics.

At their final meeting, Trump offered McCabe the job and told him he planned to give him the role of acting director. The president also said that he planned to make an appearance that week at FBI Headquarters to bolster morale. McCabe told Trump that it would be a risky move after firing a well-respected director, so the president scuttled the trip, citing scheduling conflicts.

For weeks, Trump and his allies have focused their ire on McCabe. McCabe’s wife was a candidate for Virginia state Senate in 2015, and she received donations from the super PAC supporting Terry McAuliffe, the state’s governor at the time, who was a longtime ally of Hillary Clinton’s.

A White House official confirmed Tuesday night that Trump had asked the question, saying it was in the context of first asking about McCabe’s family, which led to a discussion about McAuliffe and then to how McCabe had voted. The FBI declined to comment.

Trump has also assailed the independence of the FBI, and has described its reputation as being “in Tatters,” a stunning broadside from a sitting president against a law enforcement agency he oversees. Comey has testified publicly and under oath that Trump asked for his loyalty in one of their meetings. Trump has denied the allegation.

This article originally appeared in The New York Times.