David Petraeus, a retired four-star general and former director of the CIA, pleaded guilty Tuesday to giving highly classified information to his ex-mistress. The information came in the form of eight black books that contained everything from identities of covert officers to discussions with President Obama.

The Justice Department and Federal Bureau of Investigation alleged back in 2012 that Petraeus gave secret information to Paula Broadwell, but the seriousness of the information wasn’t clear until now.

While he was commander of coalition forces in Afghanistan, Petraeus “maintained bound, five-by-eight inch notebooks that contained his daily schedule and classified and unclassified notes he took during official meetings, conferences and briefings,” the U.S. Attorney’s Office for the Western District of North Carolina writes in a statement of fact regarding the case.

The notebooks had black covers with Petraeus’s business card taped on the front of each of them.

All eight books “collectively contained classified information regarding the identifies of covert officers, war strategy, intelligence capabilities and mechanisms, diplomatic discussions, quotes and deliberative discussions from high-level National Security Council meetings… and discussions with the president of the United States.”

The books also contained “national defense information, including top secret/SCI and code word information,” according to the court papers. In other words: These weren’t just ordinary secrets. This was highly, highly classified material.

While a historian from the Department of Defense gathered and organized classified materials that Petraeus collected while serving in the Pentagon, he “never provided the black books to his DOD historian.”

Instead, Petraeus kept the black books in a “rucksack” in his home, according to a conversation recorded by biographer and mistress Paula Broadwell in 2011.

“They are highly classified, some of them… I mean there’s code word stuff in there,” Petraeus said. Nevertheless, he emailed her and agreed to provide the black books.

Then Petraeus personally delivered the black books to a residence where Broadwell was staying in Washington, D.C. A few days later, he returned to retrieve them.

On Oct. 26, 2012, Petraeus was interviewed by FBI agents in CIA headquarters while he was still director. Petraeus told them he had never provided any classified information to Broadwell or facilitated her provision of the information.

“These statements were false. Defendant David Howell Petraeus then and there knew that he previously shared the black books with his biographer.”

On Nov. 9, 2012, Petraeus resigned from the CIA following the revelation of his affair with Broadwell. This came after Tampa socialite Jill Kelley told the FBI that Broadwell was harassing her via email. The FBI traced Broadwell’s emails and discovered she was communicating with Petraeus. The FBI told Petraeus’s boss, Director of National Intelligence James Clapper, of the suspected affair.

Upon leaving Langley, Petraeus signed a nondisclosure agreement saying “I gave my assurance that there is no classified material in my possession, custody, or control at this time.” This was when the black books, full of such material, were in his home.

Six months later, in April 2013, the FBI executed a search warrant on the Petraeus residence and seized the black books from an “unlocked desk drawer” on the first floor.

The U.S. Attorney writes that Petraeus “unlawfully and knowingly remove[d] such documents and materials without authority and thereafter intentionally retained” them in locations unauthorized for their retention.

Even now, more than two years after his downfall, news about Petraeus’s plea deal was met, in parts of the Pentagon, with shock. Some gasped upon learning the news that the most celebrated general since 9/11 was now pleading guilty to lying to his government.

At his height, Petraeus was the public face on an unpopular war who seemingly staved off violence in Iraq, albeit temporarily. Petraeus did it, in part, by bypassing the chain of command as the Iraq commander, speaking directly to then-President George W. Bush, the media, and the American public. Military academy students and lecturers still debate his unique tactics and public persona.

Such standout conduct led to a perception that the generals no longer answered to a civilian leadership. And that set off tensions between the military and its civilian leadership that remain today. In his first weeks as defense secretary, Ashton Carter has repeatedly reminded commanders and troops of the importance of the chain of command.

Neither the news that Petraeus’s name appears as the defendant on a charging sheet or that he lied to federal investigators from his Langley office shook his standing in the military community—or so it seemed.

Even those who are outraged would never publicly say so. The lingering fear that confronting Petraeus could end one’s career remains within the ranks.

Petraeus pleaded guilty to one count of unauthorized removal and retention of classified material. The deal lets Petraeus avoid a long, public trial that would reveal details of his affair with Broadwell (he’s still married to Holly Petraeus) and further sully the reputation of the best-known general of his generation.

The misdemeanor charge carries with it a one-year prison sentence, but prosecutors have suggested two years probation and a $40,000 fine. Petraeus awaits sentencing by a judge. It’s unclear if Petraeus would be stripped of his security clearance, which he kept after resigning from the CIA.