Former Bronx Assemblyman Luis Diaz pleaded guilty to defrauding New York State Supreme Court in the Bronx, forcing him to resign from his lifetime appointment as Bronx County Clerk and barring him from ever holding office again, state Attorney General Letitia James announced Wednesday.

Diaz, 69, “knowingly defrauded the court,” James said in a news release, by accepting money from Thomas Poli — an alleged Genovese crime family associate — in exchange for creating fraudlent court documents that claimed Poli completed court-mandated community service for a homeless services provider, Aguila, Inc.

The now-defunct Aguila had Diaz on the books as a paid consultant and paid Poli for “vending, storage, and furniture contracts,” James said. No community service was ever performed, according to the attorney general.

On Wednesday in the same Bronx court Diaz served since 2009, he pleaded guilty to one felony count of “Offering a False Instrument for Filing in the First Degree.”

New York State Supreme Court Judge Linda Poust-Lopez sentenced Diaz to 100 hours of community service and granted him a conditional release that could send Diaz to prison if he is rearrested in the next three years.

Poust-Lopez also barred Diaz from public office and working for nonprofit organizations registered in New York.

In a statement Wednesday, Diaz’s lawyer, Michael Farkas, strongly defended his client.

“Luis Diaz was not alleged to have abused his public office in any way, nor did he abuse that office or the public’s trust at any time,” Farkas wrote. “He was not charged with defrauding anyone or committing any official misconduct, nor did he take any money in exchange for any actions in this case, as the Attorney General nonsensically blusters in her publicity-seeking and politically driven press release.”

“What actually happened was that Mr. Diaz went too far to help a friend,” Farkas added.

Farkas argued Diaz became personal friends with Poli while working together at “a private organization” and Poli asked him for a letter saying he volunteered for the organization, when instead he was a paid worker.

“He deeply regrets acting dishonestly with regard to the letter, and he is now taking full responsibility for that mistake, just as any decent person should when they make an uncharacteristic error in judgment,” Farkas continued. “He has never once placed anyone’s interests ahead of his duties as a public official. Anyone reading the details of his plea agreement will realize this obvious fact.”

The attorney general's office referred NY1 to the press release announcing the plea agreement when asked to respond to Farkas' comments.

Poli, a 64-year-old Bronx resident, was charged with racketeering conspiracy in April as part of a probe by the state attorney general, federal prosecutors, and the Brooklyn district attorney’s office. Officials allege Poli was involved in illegal gambling and extortion rackets connected to the Genovese crime family dating as far back as 2011. He faces 20 years in prison, according to the federal indictment.

“For years, members of the Genovese crime family have terrorized New York communities with violence and illegal businesses,” James said in a statement at the time. “These individuals allegedly made their money through illegal gambling and loan sharking — saddling victims with incredible debt that they cannot repay.”

Diaz served in the state Assembly between 2002 and 2008.