The mayor of Atlantic City, New Jersey has resigned after admitting in federal court on Thursday that he stole $87,000 from a youth basketball team he founded.

The admission puts the mayor on a long line of corrupt leadership in the city, which has been riddled with chronic budget problems.

Frank Gillam Jr. told the judge he stole funds raised from donors in Atlantic City and Philadelphia for the Atlantic City Starz for personal expenses between 2013 and 2018. He was elected mayor in 2017 after serving as a City Councilman.

He was released after posting a $100,000 bond with the court, but New Jersey Gov. Phil Murphy and other elected officials quickly called for him to resign. Plans were already being made for the City Council president to assume Gillam’s position.

Gillam, 49, faces up to 20 years in prison if convicted in his trial, which is set for Jan. 7. Half of the money he stole was recovered from his home when FBI agents raided it in December, and he’s agreed to pay restitution for the fraud.

JUDGE HUGS AMBER GUYGER, GIVES HER A BIBLE AFTER MURDER CONVICTION, CAUSING A STIR

According to prosecutors, Gillam used the money for personal expenses such as luxury clothing, expensive meals and trips. He had solicited the donations using his political office under the false pretense they were for the youth basketball team or for school supplies for underprivileged children.

“When a scheme depletes (a) charity for children, it's unconscionable,” said FBI Special Agent in Charge Gregory Ehrie. “But when the fraud is perpetrated by someone the public trusts, it damages the community's confidence in their public servants. This defendant betrayed the trust of his community and of people who wanted to improve the lives of children.”

WARREN, GABBARD KNOCK HARRIS' BID TO BAN TRUMP FROM TWITTER

Gillam’s lawyer, Harry Rimm, issued a defense that Gillam only admitted misusing private funds, not public money, which he argued made the mayor better than many of his predecessors. The city was on the brink of bankruptcy when Gillam took office in 2017 as its casino industry struggled.

CLICK HERE FOR THE ALL-NEW FOXBUSINESS.COM

The Atlantic City mayoral office has a long history of rampant corruption, lending ground for the 1920s-era hit HBO series "Boardwalk Empire."

As of 2007, four of the city's last eight mayors had been arrested on corruption charges and one-third of the nine-member City Council was either in prison or under house arrest.

Robert Levey, mayor of the city from 2006-2007, admitted in court to falsifying his military record to receive $25,000 worth of benefits. In 1991, former mayor James Usry admitted to a campaign finance violation of accepting $6,000 in exchange for supporting an ordinance that would benefit the company that offered the money.

The Associated Press contributed to this report.