Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Federal prosecutors say an IRS investigator in California has admitted leaking confidential details of financial transactions by former Trump attorney Michael Cohen to Michael Avenatti, lawyer for Stormy Daniels.

John C. Fry has been charged in federal court with searching for and disseminating Suspicious Activity Reports (SARs), reports filed by banks when they note potentially suspicious transactions.

Federal officials say they found telephone records that indicate Fry placed a phone call from his personal cell phone to that of Stormy Daniels’ attorney Michael Avenatti the day before Avenatti released details of Cohen's financial transactions, and the day after.

The federal complaint says Fry verbally admitted providing the information to Avenatti when he was confronted by federal agents.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Via Twitter, Avenatti disseminated information about Cohen's receipt in 2017 of $500,000 from Columbus Nova, a company with ties to a Russian billionaire, as well as payments to a Cohen company called Essential Consultants from other firms who do business with the federal government, including AT&T and aircraft manufacturer.

The Treasury Department's Inspector General's Office announced after Avenatti's disclosure that it would be investigating the source of his information.

Fry, 54, is an investigative analyst with the law enforcement arm of the IRS, the Criminal Investigative Division. He has worked for the IRS since 2008.

According to the complaint, he conducted numerous searches related to Cohen, and downloaded five SARs, including one related to a bank account for Essential Consultants.

In a statement, Avenatti told NBC News, "I have done nothing wrong and did not violate any law whatsoever, just like reporters don’t violate the law when they do their jobs."

The court filings also end months of uncertainty about whether Cohen's records were "missing."

The complaint says an individual identified as "Reporter-1" exchanged 57 WhatsApp messages with Fry in May and June 2018, and then published an article in the New Yorker titled, "Missing Files Motivated the Leak for Michael Cohen's Financial Records."

The sole byline on the article is Ronan Farrow.

According to the complaint, the SARs were not missing. Instead, two "important" SARs were given restricted access, meaning that they were not available for viewing by registered users in the FinCEN system, including John Fry.