A former Huntington Beach police detective was sentenced Thursday to community service and informal probation for stealing from a collection of cash raised by other officers.

As part of a plea deal requiring he admit to a misdemeanor count of petty theft, Mario Ricci, 49, of Los Angeles was ordered to complete 240 hours of community service, to spend a year on informal probation and to pay an unspecified amount of restitution.

Ricci’s attorney, Ed Welbourn, described the plea deal as fair, noting his client had made a “lapse in judgement.”

“He wanted to do the right thing and take responsibility for his actions,” Welbourn said.

According to prosecutors, Ricci stole money out of an envelope at Huntington Beach police headquarters containing cash that officers were collecting to buy a gift for a retiring colleague.

Other Dec. 8, 2016, detectives noticed that money was missing. A day later, they documented the denominations and serial numbers of the remaining bills in the envelope.

Huntington Beach investigators on Dec. 15, 2016 contacted Ricci as he left the police building, prosecutors said, and found in his possession bills that they had previously documented as being in the donation envelope.

Prosecutors did not disclose the amount of money that was taken.

Huntington Beach police officials placed Ricci, an 18-year veteran with the department who was working in general investigations, on administrative leave after the theft came to light. He is no longer with the department, Huntington Beach Police Officer Angela Bennett said.