Christopher Wray, the FBI director who has been one of the fiercest critics of encryption under the Trump administration, previously worked as a lawyer for WhatsApp, where he defended the practice, according to new court filings.

The documents, which were released late on Wednesday night as part of an unrelated matter, show Wray worked for WhatsApp in 2015 while he was an attorney for the Washington law firm of King & Spalding.

While there are sparse details about the precise nature of the work, the filings indicate that Wray strongly defended the need for end-to-end encryption in his previous representation of WhatsApp, the popular messaging application owned by Facebook.

Wray’s earlier work – which has not previously been public – contradicts his current position on encryption, which protects users’ communications and other data from being read by outsiders.

The Trump administration and major technology companies like Facebook have been at odds over the need to offer customers encryption services, with the White House and law enforcement officials arguing the technology represents a security risk by protecting the communication of terrorists and criminals.

Wray defended the administration’s position as recently as February, when he claimed law enforcement would in effect be severely hampered if Facebook decided to move forward with plans to offer users end-to-end encryption in its messaging platform.

“We have to have mechanisms to allow lawful access to protect flesh and blood Americans,” Wray said at a congressional hearing. “If Facebook moves forward with the plans they have at the moment, we will be blinded.”

In a statement, the FBI said Wray could not comment on the scope of his representation. “When he was an attorney in private practice [Director Wray] represented his clients’ interests and advocated on their behalf, as a result of which he earned a reputation as a highly skilled and sought-after legal professional. Like all other lawyers, his duty of loyalty was to his client, and he did not put his personal views ahead of his clients’ interests or allow them to affect the legal work he did for clients. Today, as director of the FBI, his duty is to act in the best interests of the American people.”

News about Wray’s representation of WhatsApp was released as part of a legal dispute between WhatsApp and attorneys representing NSO Group, the Israeli spyware maker.

WhatsApp has claimed that it is improper for NSO Group to be represented in their dispute by King & Spalding given the firm’s previous work for WhatsApp. It declined to provide more details about the previous case, which is under seal.