NEW YORK — Michael Cohen pleaded guilty to eight counts Tuesday after reaching a plea deal with federal prosecutors who were investigating his business dealings in New York.

President Trump’s former personal lawyer and fixer pleaded guilty to five counts of tax evasion; one count of lying on a bank loan application; one count of causing an unlawful corporate contribution “in coordination and at the direction of a candidate for federal office”; and one count of making an excessive campaign contribution.

Standing before a packed courtroom in lower Manhattan, Cohen himself told U.S. District Judge William Pauley that he committed the campaign finance crimes “at the request of” the candidate “for the purpose of influencing the 2016 election.”

Court documents released by the government explicitly note that Cohen committed these acts while in the employment of “Individual-1,” or President Trump. Executives at “the Company,” or the Trump Organization, reimbursed Cohen for campaign finance violations he made to benefit Trump, according to the document. They were falsely invoiced as legal retainer agreements but did not actually relate to legal work Cohen did on the company’s behalf.

Cohen faces up to 65 years and heavy financial penalties if he receives the maximum sentence for the crimes. Cohen was released on $500,000 bail Tuesday afternoon, with restrictions imposed on his travel.

Cohen agreed to plead guilty on these charges rather than facing a jury trial.

“Are you pleading guilty to each of those counts because you are guilty?” Pauley asked Cohen at several points during the proceedings.

“Yes, sir,” a somber Cohen replied.

After the hearing wrapped, Cohen’s attorney Lanny Davis released a statement saying that his client had told “the truth about Donald Trump.”

“Today he stood up and testified under oath that Donald Trump directed him to commit a crime by making payments to two women for the principal purpose of influencing an election,” Davis’ statement read. “If those payments were a crime for Michael Cohen, then why wouldn’t they be a crime for Donald Trump?”

In the courtroom, the judge, Assistant United States Attorneys Andrea Griswold and Cohen explained the charges he was admitting to in detail.

Counts one through five involved what Cohen described as “evaded paying taxes on certain income I knew was not reflected on my tax returns.” The charges related to the years 2012, 2013, 2014, 2015 and 2016.

Count six related to Cohen wilfully misrepresenting his income in an application for a home equity line of credit in February 2016. He testified that he did so by inaccurately describing the extent of the liabilities he faced from outstanding loans, and by lying about his cash flow.

Though he did not mention Trump by name, Cohen directly implicated the President when describing counts seven and eight.

Seven involved a $150,000 payment Cohen coordinated with a corporation “at the request of the candidate” to quash information that would be harmful to the campaign, with the “principal purpose of influencing the election.”

The details described match up with the $150,000 that the National Enquirer’s publisher paid to a former Playboy model to “catch and kill” the story of her alleged affair with Trump. Cohen has released a September 2016 recording he covertly made of him discussing coordinating that payment with Trump.

The eighth and final count involved the $130,000 Cohen said he paid through an LLC he owned to an “individual who had information that would be harmful to the candidate.” That hush money payment to adult film star Stormy Daniels far exceeded campaign contribution limits and was explicitly made to benefit the campaign.

Cohen appeared to be in good spirits when he first entered the courtroom at around 4 p.m. in a dark suit and gold tie. He flashed a smile at the sketch artist and chatted with his lawyers. When Pauley asked if he’d consumed any drugs or alcohol prior to the hearing, Cohen told the courtroom that the previous night at dinner he had “a glass of Glenlivet 12 on the rocks.”

But as the proceedings progressed and he was asked to describe his activities in detail, his facade cracked. Periodically, Cohen shook his head and looked down at the table.

At one point, Pauley asked Cohen whether he understood that pleading guilty would result in Cohen giving up certain civil rights, such as the right to vote. When Cohen responded “yes, sir,” his voice broke. Cohen’s attorney, Guy Petrillo, patted him on the back.

News of Cohen’s plea deal began trickling out earlier Tuesday.

It’s uncertain whether Cohen’s plea means he will cooperate with prosecutors by providing information relevant to other cases.

The New York Times reported that Cohen’s deal “does not include cooperation with federal authorities,” according to two unnamed people familiar with the matter.

CNN, citing an unnamed source, said Cohen “was not expected to cooperate with the government,” as part of a deal under discussion earlier Tuesday.

Under the bail terms set forth by Pauley, Cohen must surrender any firearms and ammo within 24 hours. His travel will be limited to the northern district of Illinois, the southern district of Florida, Washington, D.C. and the eastern and southern districts of New York.

A sentencing hearing was scheduled for December 12.

Read the full plea agreement and information set forth by prosecutors below.

This post has been updated.