A former consultant to Mayor Vincent Gray's 2010 campaign will serve two years on probation for lying to the FBI after prosecutors acknowledged that Howard Brooks offered "substantial assistance" in one of the probes into D.C. political corruption.

U.S. District Court Judge Colleen Kollar-Kotelly also ordered Brooks on Wednesday to perform 200 hours of community service, at a rate of at least 20 hours per month.

"You seem to have lost your moral compass for a period," said Kollar-Kotelly, who is handling all of the cases linked to the Gray campaign.

Before Kollar-Kotelly imposed her sentence, Brooks apologized to residents in the District for his misconduct during the campaign.

"I did break the law," Brooks said. "I can't emphasize enough how much I regret that."

Brooks acknowledged in May that he helped direct payments to Sulaimon Brown, a minor mayoral candidate, so Brown would remain in the primary race to criticize then-Mayor Adrian Fenty, Gray's rival.

After Brown went public with his allegations and prompted an investigation, Brooks "deliberately and repeatedly" lied in an interview with FBI agents, prosecutors said.

But Brooks ultimately had a change of heart.

Although prosecutors did not announce the single felony charge against Brooks until May, the disgraced power broker had reached a plea deal with authorities in October 2011. The bargain included a requirement that Brooks cooperate with the probe.

Brooks' eventual cooperation with investigators was so extensive that prosecutors only gave specific details of his assistance in sealed court records.

Although officials have refused to provide details of what evidence Brooks helped gather, Thomas Gore, the Gray campaign's assistant treasurer, referred in a May court appearance to a conversation federal agents heard through "a wire."

Gore has pleaded guilty to a set of charges, including one linked to his shredding of records of the payments to Brown. Kollar-Kotelly has not yet scheduled sentencing.

Authorities are also looking into the existence of a $653,800 shadow campaign that helped elect Gray, and one person has already pleaded guilty to her role in the scheme.

Gray has repeatedly denied wrongdoing and has vowed to finish his term, defying demands from several city lawmakers that he tender his resignation immediately.