An IRS staffer whom authorities accused of leaking confidential financial information about Michael Cohen to Michael Avenatti has pleaded guilty to accessing and distributing that information illegally.

John C. Fry, 54, a former investigative analyst with the IRS Criminal Investigation Division, the law enforcement arm of the agency, pleaded guilty Wednesday to one count of unlawful disclosure of Suspicious Activity Reports (SARs), NBC News reports.

Fry admitted in court to handing over Cohen’s confidential financial forms to Michael Avenatti, the ex-attorney for porn star Stormy Daniels who represented her in her lawsuit against President Trump, with whom she claims she had an affair, which Trump has denied.

Fry logged into the IRS’s Financial Crimes Enforcement Network twice in May 2018 and downloaded five SARs on Cohen and his company, Essential Consultants.

SARs refer to reports filed by banks when they notice transactions that they view as potentially suspicious.

Fry gave Avenatti that information via cellphone correspondence as well as through emailing him screenshots of the reports.

Within days of Fry leaking the intel, Avenatti publicized the information on Twitter.

He specifically noted Cohen’s $500,000 payday in 2017 from Columbus Nova, a company with Russian ties, and companies including AT&T.

Avenatti, who is battling federal indictments on fraud and extortion charges, was then representing Daniels in her legal fight over a nondisclosure agreement she signed before the 2016 election preventing her from discussing her alleged affair.

Cohen admitted publicly to arranging the deal with Daniels and paying her $130,000 in February 2018, leading Daniels to argue that the agreement had become invalid and that she was within her rights to speak publicly about her alleged tryst with Trump.

After Avenatti released the information on his then-rival Cohen, the Office of Inspector General for the Treasury Department said it was launching an investigation into the source of the leaks.

“Fry was given access to sensitive and powerful government databases including people’s most private financial information and he was given that access to do his job as an investigative analyst,” David L. Anderson, US attorney for the Northern District of California, said in a statement, according to NBC.

“He decided his politics were more important than his obligation to follow the law. In that, he was mistaken.”

Fry faces a maximum sentence of five years behind bars and up to $250,000 in fines.