Former House speaker J. Dennis Hastert has reached a tentative deal with federal prosecutors to resolve charges that he violated banking laws to cover up hush-money payments related to long-buried misdeeds.

The deal, which was discussed in a Thursday morning court hearing in Chicago, could mean that details of those past misdeeds will never be aired in open court. Several people familiar with the case have said that the seven-figure payoffs were to cover up allegations of sexual misconduct dating to Hastert’s days as a teacher and wrestling coach in Illinois.

The U.S. attorney’s office in Chicago and a lawyer for Hastert, Thomas C. Green, confirmed the pending deal Thursday.

Hastert is expected to enter a guilty plea Oct. 28, both parties said. They did not say what charges Hastert will plead guilty to or under what other terms he is doing so.

Assistant U.S. Attorney Joseph Fitzpatrick said the terms of the deal won’t be disclosed until a guilty plea is formally entered. Prosecutors will give the judge a draft of the written plea agreement by Monday, he said, but that is a private draft for the judge’s eyes only.

Hastert, who is 73 and served as speaker from 1999 to 2006, did not appear in court Thursday.

Widespread shock and a frenzy of questions in both Washington and Hastert’s hometown greeted the May indictment charging him with illegally “structuring” bank withdrawals and with making false statements to federal agents.

The indictment laid out a scheme in which  Hastert had agreed to pay $3.5 million to an unnamed individual from Yorkville, Ill., where he had coached and taught between 1965 and the early 1980s, to cover up “past misconduct” that had occurred “years earlier.”

Starting in 2010, prosecutors allege, Hastert paid out roughly $1.7 million in cash to the person. In an apparent attempt to keep bank and government officials from investigating the payoffs, he withdrew the cash in a series of relatively small transactions. That, prosecutors say, constituted an illegal evasion of a federal law that requires financial institutions to report cash transactions above $10,000 to authorities.

When FBI agents confronted Hastert about the withdrawals at his Illinois home in December, he told them he “kept the cash” because he didn’t trust the banking system, the indictment said, thus inviting the false statements charge.

The indictment revealed little about the nature of Hastert’s misconduct, and his lawyers have sharply criticized prosecutors for leaks that have characterized the motive for the payments. A federal law enforcement official told The Washington Post in May that the recipient was a male student Hastert had allegedly sexually molested decades ago.

A guilty plea would serve the interests of both parties in the case, said Peter R. Zeidenberg, a former federal prosecutor who is now a white-collar defense attorney in Washington.

The government would avoid the risk and expense of a potentially lengthy trial over what are relatively minor criminal charges. And Hastert would not only be likely to receive a more lenient sentence than were he to be convicted at trial, he would also retain much more control over what details of his past conduct would enter into the public record.

The need to establish the facts of the case, for instance, could prompt prosecutors to call the person Hastert is accused of paying off as a witness.

“My suspicion is that he didn’t want any of that back story to become public,” Zeidenberg said. “Inevitably it would come up: What was motivating this? What was driving it? How did this investigation get started? . . . It’s almost unavoidable and almost unimaginable to think that this trial would be simply about bank withdrawals.”

Hastert last appeared in court June 9 to enter a not-guilty plea before U.S. District Judge Thomas M. Durkin; he was released pending trial. Recent filings in the case have made clear that talks have been underway to resolve the case before a trial.

The two counts specified in the indictment each carry maximum penalties of up to five years in prison and $250,000 in fines. Depending on what charges he admits to and the applicable federal sentencing guidelines, Hastert can expect a considerably more lenient sentence.

“I think there’s a very realistic possibility that he’ll get no jail time or home detention or some minimal amount of jail time,” Zeidenberg said. Fitzpatrick and Green both declined to discuss potential sentences.

Prosecutors could push Hastert to consent to some amount of jail time, perhaps as a condition for keeping embarrassing information out of the statement of facts typically entered into the court record by a person entering a guilty plea. But even if Hastert were to make such an arrangement, sentencing would remain at Durkin’s discretion.

Ellen Nakashima contributed to this report.