An Internal Revenue Service employee in San Francisco illegally sent confidential financial reports about President Donald Trump’s former personal lawyer to a journalist and a prominent attorney, prosecutors say.

IRS investigative analyst John C. Fry was charged earlier this month with illegally disclosing suspicious activity reports — investigative records the service kept detailing potentially illegal transactions involving Trump fixer Michael Cohen.

An affidavit unsealed Thursday alleges that Fry, a 54-year-old San Francisco man whose job gave him access to confidential databases of the reports, downloaded five reports pertaining to a corporation Cohen set up that drew the attention of IRS investigators in May 2018.

Prosecutors said Fry then shared those documents with Michael Avenatti, who rose to prominence as the attorney for Stormy Daniels, a former adult film star who alleged Cohen paid her $130,000 during the 2016 campaign to keep quiet about an extramarital affair with Trump.

Avenatti posted information from the reports on Twitter four days later. That information was in turn picked up in a Washington Post story that detailed a “complex set of transactions involving the Essential Consultants account.”

Fry also exchanged text messages and shared information from confidential IRS documents with Ronan Farrow, a reporter for The New Yorker, who quoted Fry anonymously in a May 16 story about Cohen’s leaked financial records, according to the affidavit.

When investigators interviewed Fry in November he admitted to providing Avenatti and Farrow with information from the records, authorities said.

Fry is out of custody on a $50,000 bond. He is next due in court on March 13.