LAS VEGAS - Bruno Mars had two firsts this week. One was winning a Grammy. The other came Wednesday when the 25-year-old singer-songwriter pleaded guilty to cocaine possession.
Unlike the award for his hit, ''Just The Way You Are,'' his brush with the law in Las Vegas may not last forever.
Mars will avoid prison and will have no conviction on his record if he stays out of trouble for a year and meets other conditions of his plea deal.
Bruno Mars is pictured in district court in Las Vegas on Wednesday.
Clark County District Judge Jessie Walsh made sure Mars understood that he could face up to four years in state prison if he violates the terms of the agreement.
''You understand the penalty range?'' she asked.
''Four years,'' Mars replied, standing in a dark suit with his hands at his sides.
The judge gave Mars, whose real name is Peter Gene Hernandez, probation, a $2,000 fine, 200 hours of community service at a nonprofit organization and eight hours with a drug counselor in Los Angeles.
Walsh set a Jan. 18 date for Mars to return to court.
His Las Vegas lawyer, Richard Schonfeld, told the judge that Mars intends to meet the requirements.
The Honolulu-born Mars, who performed Sunday at the Grammys and took home the award for best male pop vocal performance for his song, declined to comment in the court hallway.
He acknowledged having 2.6 grams of cocaine when he was arrested in a bathroom early Sept. 19 after a nightclub performance at the Hard Rock Hotel & Casino in Las Vegas.
Police say he told the arresting officer he never used drugs before.
Mars' Los Angeles lawyer, Blair Berk, has said the singer appreciates the chance he was getting as a first-time offender to have the felony charge dismissed.
The former child entertainer began his career in Hawaii at age 4 as an Elvis impersonator. He moved to Los Angeles in 2002 to further his career.
His label, Elektra, announced Tuesday that Mars would headline with recording artist Janelle Monae on a North American tour dubbed ''Hooligans in Wondaland.''