On the same day that Republicans will vote to elect a new speaker of the House, Dennis Hastert—who served in that position longer than any Republican in history—pleaded guilty Wednesday in Chicago to a felony charge of evading federal bank-reporting laws.

It’s a sad closing to Hastert’s public career, but the deal is about the best he could have hoped for. While Hastert could be fined $250,00 and sentenced to five years in prison on the charge, he’s expected to serve zero to six months instead, and a charge of lying to the FBI was dropped as part of his plea deal. And by pleading, Hastert avoids a messy, embarrassing trial over why he was working to evade bank laws: He was reportedly withdrawing large sums of money to pay hush money in a blackmail scheme involving sexual misconduct when Hastert was a high-school teacher and wrestling coach. (The indictment withheld details, apparently at Hastert’s lawyers’ request.)

Hastert, of Illinois, was indicted in May. The plea has been expected. The exact details, including whether he will face jail or probation, remain unclear. Sentencing will not be until February 29.

Hastert served as speaker from 1999 to 2007. He ended up with the gavel thanks to the fall of two men who had their own sexual scandals. When Speaker Newt Gingrich was forced out by fellow Republicans in the wake of the Monica Lewinsky impeachment, Bob Livingston was tabbed as his replacement, but instead retired after admitting to an extramarital affair. Hastert’s reputation lives on in the House, where he is credited with the “rule” that he’d bring no bill to the floor without the support of a majority of the majority. Outgoing Speaker John Boehner’s willingness to pass some bills with Democratic support even when a majority of Republicans opposed them weakened his standing. But the presumptive Speaker Paul Ryan has vowed to respect the Hastert Rule—which continues to be referred to as such, despite its author’s downfall.