By Associated Press
Updated January 18, 2012 at 08:16 PM EST
Michael Caulfield/AMA2011/Getty Images

Pop star Bruno Mars was cleared of a felony cocaine-possession case in Las Vegas on Wednesday, after his attorneys told a state court judge the Grammy-winning pop star stayed out of trouble, performed community service, and met other conditions of a plea deal reached almost a year ago.

Mars, whose real name is Peter Gene Hernandez, didn’t appear in person for the brief hearing at which Clark County District Court Judge Jessie Walsh dismissed the case. The 26-year-old singer-songwriter of hits including “Just the Way You Are,” ”It Will Rain,” and “Grenade” pleaded guilty on Feb. 16 to cocaine possession, but the judge postponed accepting the plea.

Mars didn’t get formal probation, but the judge fined him $2,000 and ordered him to perform 200 hours of community service and 8 hours of drug counseling.

Mars acknowledged having 2.6 grams of cocaine when he was arrested in a bathroom in Sept. 2010 after a nightclub performance at the Hard Rock Hotel & Casino in Las Vegas. He could have faced up to four years in state prison, but attorney Blair Berk said Mars met the court requirements and logged more than the required 200 hours of community service. “Bruno earned the dismissal,” the lawyer told reporters after the hearing. “He exceeded the expectations of the court.”

Berk has said the singer appreciated the chance he got as a first-time offender to have the felony charge dismissed. She said Mars’ community service was in Los Angeles and Minneapolis, on efforts including charity videos and concerts, an anti-bullying campaign, and work with children’s charities and health organizations.

The former child entertainer from Hawaii began his career at age 4 as an Elvis impersonator. He moved to Los Angeles in 2002. He won best male pop-vocal performer at the Grammys last year, is nominated for six awards, and is due to perform at the upcoming awards show Feb. 12 in Los Angeles.

More on

Bruno Mars arrested for alleged cocaine possession

Bruno Mars strikes deal in cocaine case

‘Twilight: Breaking Dawn — Pt. 1’ soundtrack revealed; will feature Bruno Mars, Christina Perri, Iron & Wine and more — Hear the first single here