Former GOP House Speaker Dennis Hastert was indicted by federal prosecutors on Thursday for allegedly concealing large cash withdrawals in order to keep "prior misconduct" secret and then lying about it to the FBI.

Hastert served as the Speaker of the House from 1999 to 2007, making him the longest-serving Republican to ever hold the position. However, before being elected into office, Hastert worked as a high school teacher and coach in Yorkville, Illinois, from 1965 to 1981.

According to the indictment, the 73-year-old former congressman agreed to pay someone identified as "Individual A" a total of $3.5 million. Although the indictment does not explain the nature of the "past misconduct," it does detail the withdrawals and financial transactions that he made with the unnamed person.

"During the 2010 meetings and subsequent discussions, Hastert agreed to provide Individual A $3.5 million in order to compensate for and conceal his prior misconduct against Individual A," reads the indictment, according to CNN.

The indictment also states that he paid about $1.7 million from 2010 to 2014.

However, federal law enforcement officials later revealed on Friday that Hastert used the payments as hush money to conceal allegations of sexual abuse from a former male student that he knew while he worked as a teacher, reports The Los Angeles Times.

"It goes back a long way, back to then," an official said. "It has nothing to do with public corruption or a corruption scandal. Or to his time in office." Instead, the official confirmed that the nature of the alleged misconduct "was sex."

The Illinois Republican has been accused of withdrawing $952,000 and paying the unidentified person to "compensate for and conceal his prior misconduct." Plus, he is accused of circumventing federal standards that requires banks to report withdrawals over $10,000.

"Beginning in approximately July 2012, Hastert started structuring his cash withdrawals in increments of less than $10,000 to evade the filing of Currency Transaction Reports ('CTRs'), which banks are required to file for cash withdrawals in excess of $10,000," federal prosecutors said.

When questioned by the FBI in December 2014, he allegedly lied and said he was keeping the cash because he did not trust the banking system, states the indictment.

As a result, Hastert was "charged with one count each of structuring currency transactions to evade currency transaction reports" in addition to giving the FBI a false statement, reports NBC News.

His bail was set at $4,500, but Hastert was released on his own recognizance.