DETROIT (WJBK) -A federal judge sentenced former Detroit Mayor Kwame Kilpatrick Thursday to 28 years in prison for his role in a public corruption scandal that cost the city millions and ended a career for the once promising politician.

U.S. District Judge Nancy Edmunds handed down the sentence after Kilpatrick apologized to Detroiters, telling a packed gallery, “I really messed up.”

Kilpatrick spoke for nearly 30 minutes saying he “absolutely hated his job” six months after taking office in 2002 and put out “an air of false confidence.” He didn’t specifically address his crimes but said he respects the jury’s verdict. He was convicted of conspiracy, extortion, bribery and tax crimes last March.

Prosecutors said Kilpatrick ran a “private profit machine” out of Detroit’s City Hall. The government presented evidence to show he got a share of the spoils after ensuring that co-defendant Bobby Ferguson’s excavating company was awarded millions in work from the water department.

“This case is not so much about punishing for the past as it about shaping the future,” said U.S. Attorney Barbara McQuade in a statement. “A significant sentence like this one will deter other officials from stealing from the people and will attract honest public servants to office.”

“I want the city to heal. I want it to prosper. I want the city to be great again,” Kilpatrick said in his remarks to the judge. “I want the city to have the same feeling it had in 2006 when the Super Bowl was here.”

Kilpatrick, a Democrat, quit office in 2008 in a different scandal that was extraordinary at the time but seems smaller compared with the sweeping federal probe that has led to the convictions of more than 30 people. Sexually explicit text messages revealed that Kilpatrick had lied during a trial to cover up an affair with his top aide, Christine Beatty, and to hide the reasons for demoting or firing police officers who suspected wrongdoing at city hall.

Detroit voters soon will elect a third mayor since Kilpatrick’s departure, although the city is under the control of an emergency manager, Kevyn Orr, for at least another year. Orr, with the blessing of Michigan’s governor, took Detroit into bankruptcy in July, saying there was no other way to solve $18 billion in long-term debt. The case is pending.

Ferguson is scheduled to be sentenced on Friday. He was convicted of 9 counts of public corruption. Prosecutors argued that he should get a sentence similar to Kilpatrick’s. Ferguson’s attorneys have said he should get no more than 10 years.

Kilpatrick’s father, Bernard, is scheduled to be sentenced next week. He was convicted of one count of filing a false tax return.