(CNN) —  

Federal prosecutors have agreed to drop 24 felony counts against disgraced former US Rep. Aaron Schock if the Illinois Republican agrees to pay back taxes and reimburse his campaign committees.

In court Wednesday, US District Judge Matthew Kennelly read many of the offenses Schock had been accused of, including submitting vouchers for mileage while driving vehicles for business that exceeded the amount of miles he drove. He was also accused of obtaining tickets for the World Series and Super Bowl at face value then selling them for a profit.

As part of the agreement, Schock has agreed to pay more than $40,000 in back taxes to the Internal Revenue Service that he failed to report over a six-year period. Schock also agreed to pay back his campaign committees approximately $68,000.

Schock for Congress also pleaded guilty to one count of failing to properly report expenses, a misdemeanor.

Kennelly also mandated that Schock avoid any future legal problems.

“I am very pleased this case is concluding. This case has dragged on for more than four years and I am ready to put this behind me and move forward,” Schock said in a statement following court proceedings.

While approving the agreement, Kennelly told Schock that if he fails to uphold any terms of the agreement, the US attorney’s office would be able to initiate prosecution for any offense.

“It’s been an extraordinary learning experience,” Schock told media following court.

“I’ve learned a lot about myself. I’ve learned a lot about the criminal justice system … my view is to focus on the positive. Not the ugliness of the last four years,” he said.

Schock, who served four terms in Congress, resigned in 2015 in the wake of a congressional ethics investigation into reports that he used taxpayer money to fund lavish trips and events.

The scandal surrounding the Illinois Republican’s spending practices ballooned when a Washington Post profile of his whimsically decorated office published in early 2015 raised initial questions about his finances.

Schock ended up paying back the government the $40,000 it cost to redecorate his office in the style of the popular PBS drama “Downton Abbey,” but the controversy didn’t stop there. The Illinois Republican later came under scrutiny for flights on private jets – including planes owned by key donors – concert tickets and other entertainment expenses.

CORRECTION: This story has been updated to reflect the amount Schock agreed to pay back to his campaign committees.