Former Chief of Staff to the Department of Defense Kash Patel speaks during a campaign rally at Minden-Tahoe Airport on October 08, 2022 in Minden, Nevada.
CNN  — 

Kash Patel, an adviser to Donald Trump, testified on Thursday before a federal grand jury investigating the handling of records taken to the former president’s Mar-a-Lago home and resort, a source familiar with the matter tells CNN.

A federal judge had ordered Patel to testify before the grand jury, granting him immunity from prosecution on any information he provides to the investigation. The court’s decision is under seal, and grand jury proceedings are secret.

A Patel spokesman said: “Mr. Patel categorically denies reaching any immunity ‘deal’ with the government. Rather, his testimony was compelled over his objection through the only legal means available to the government – a grant of limited immunity.”

Patel was subpoenaed to the secret grand jury last month but declined to answer questions by asserting his Fifth Amendment protection from self-incrimination.

Patel is one of a handful of advisers around Trump after his presidency who could have legal risk related to the Mar-a-Lago situation. He served as a national security and defense official during the Trump administration, and this summer became one of Trump’s designees to interact with the National Archives and the Justice Department as both agencies tried to repossess classified records Trump kept from his presidency.

The Washington Post first reported Patel’s appearance.

This story has been updated with additional details.

CNN’s Katelyn Polantz contributed to this report.