CNN  — 

Allen Weisselberg, the former chief financial officer of the Trump Organization, pleaded guilty Thursday to his role in a 15-year-long tax fraud scheme, and as part of the deal he has agreed to testify against former President Donald Trump’s real estate company at trial.

In court Thursday, Weisselberg said, “Yes, your honor” when asked if he was pleading guilty of his own choice.

Weisselberg pleaded guilty to 15 felonies and admitted he failed to pay taxes on $1.7 million in income, including luxury perks, such as rent and utilities for a Manhattan apartment, leases for a pair of Mercedes-Benz cars and private school tuition for his grandchildren.

He admitted to concealing those benefits from his accountant to under-report his income and knowingly omitting the income from his personal tax returns.

Weisselberg answered a series of specific questions about the scheme from the judge in a hushed and barely audible tone, saying “Yes, your honor” repeatedly.

As part of the deal, he will pay nearly $2 million in back taxes, interest and penalties and waive any right to appeal.

Judge Juan Merchan said Weisselberg would be sentenced after the Trump Organization’s trial. He said the agreement was for a five-month sentence to be followed by five years of probation. The judge warned Weisselberg if he does not meet all the conditions of the plea agreement, “I would be at liberty to impose any lawful sentence which in your case includes imprisonment from 5 to 15 years.”

The plea puts him at odds with the Trump Organization, where he worked for 40 years, and his testimony could damage the company, if it goes to trial on related tax charges as scheduled in October.

Nicholas Gravante Jr., the lead attorney for Weisselberg, said in a statement that Weisselberg is happy to put this decision behind him.

“In one of the most difficult decisions of his life, Mr. Weisselberg decided to enter a plea of guilty today to put an end to this case and the years-long legal and personal nightmares it has caused for him and his family,” Gravante said. “Rather than risk the possibility of 15 years in prison, he has agreed to serve 100 days. We are glad to have this behind him.”

In a statement provided to CNN Thursday, a spokesperson for the Trump Organization said, “The two Trump companies that the Manhattan DA has been targeting, however, will not be taking a plea for the simple reason that they have done nothing wrong. As a result, we now look forward to having our day in court, which, quite interestingly, has been scheduled for October 24 – just days before the midterm elections.”

The statement went on to call Allen Weisselberg, “a fine and honorable man” who has been “harassed, persecuted and threatened by law enforcement, particularly the Manhattan District Attorney,” all in an effort to get the former President.

Weisselberg has been fiercely loyal to the Trump family, having worked for them since 1973. Yet even by providing testimony against the company Weisselberg will not implicate any Trump family members, who were not accused of any wrongdoing. If the Trump Organization is convicted, it could be required to pay back taxes and fines, but no individual will go to prison.

“Today Allen Weisselberg admitted in Court that he used his position at the Trump Organization to bilk taxpayers and enrich himself,” Manhattan District Attorney Alvin Bragg said in a statement. “This plea agreement directly implicates the Trump Organization in a wide range of criminal activity and requires Weisselberg to provide invaluable testimony in the upcoming trial against the corporation. Furthermore, thanks to the incredibly hard work and dedication of the team prosecuting this case, Weisselberg will spend time behind bars. We look forward to proving our case in court against the Trump Organization,” Bragg said.

Weisselberg will likely serve at Rikers Island, New York City’s notorious jail. With credit given for good behavior, one-third of the sentence could be knocked off, meaning Weisselberg could end up serving about 100 days behind bars. None of the charges facing Weisselberg have mandatory incarceration but the most serious of the charges has a maximum sentence of 15 years.

Prosecutor Joshua Steinglass said during the hearing that if Weisselberg fails to meet all of the obligations, they will recommend a sentence in state prison.

The Manhattan district attorney’s office announced the tax charges last summer as it put pressure on Weisselberg to cooperate against Trump in the wide-ranging investigation into whether the Trump Organization and its top executives provided misleading financial statements to obtain loans, insurance and tax benefits. No charges have been brought in that investigation, which prosecutors say is continuing.

Weisselberg is not cooperating with New York prosecutors in that criminal investigation.

The guilty plea comes two months before Weisselberg was set to go to trial and one week after a New York state judge denied his motion to dismiss the indictment.

Representatives for the Trump Organization have denied any wrongdoing. Trump has called the investigations politically motivated. No other executive was indicted in the tax case and Trump, Donald Trump Jr., Eric Trump and Ivanka Trump were not accused of any wrongdoing.

The Trump Organization was charged with 10 counts and Weisselberg with 15 felony counts in connection with an alleged scheme stretching back to 2005 “to compensate Weisselberg and other Trump Organization executives in a manner that was “off the books.”

There are few people, including Weisselberg, who could explain how decisions were made in the Trump Organization, and his testimony will provide insights at trial.

Weisselberg acknowledged Thursday that the scheme was carried out with Jeffrey McConney, the longtime controller of the Trump Organization.

McConney, who reported to Weisselberg, received immunity for his testimony before the grand jury, people familiar with the matter previously told CNN. He was named as an unindicted co-conspirator in the indictment.

Weisselberg’s guilty plea comes during a dramatic legal period for Trump, who last week at a deposition in the New York attorney general’s civil investigation, asserted his Fifth Amendment right and declined to answer hundreds of questions about the Trump Organization’s financial statements.

That came two days after the FBI executed a search warrant on Trump’s private Mar-a-lago residence in Florida, as part of a criminal investigation into the handling of presidential records, including classified documents.

This story has been updated with additional developments.