Bruno Mars

Bruno Mars has dodged a bullet in court.

The Grammy winner pleaded guilty to felony possession of cocaine Wednesday in Las Vegas. As part of the plea deal, Mars has been placed on probation for a year and must pay a $2,000 fine. He was also ordered to take a drug counseling course online and perform 200 hours of community service. If he abides by these requirements and keeps a clean record, the case against him will be dismissed.

Bruno Mars plans plea bargain in cocaine case

The singer, whose real name is Peter Hernandez, was arrested last year at the Hard Rock Hotel and Casino, the Las Vegas Sun reports. He was found in the hotel bathroom with 2.6 grams of cocaine on him in September.

Grammys 2011: The best performances

Mars recently performed at the Grammys alongside B.o.B. and Janelle Monáe. His songs "Billionaire," "Marry You" and "Just the Way You Are" have been covered on Glee.