Grammy-winning rapper Eminem received one year of probation Thursday for a weapons charge authorities say stemmed from a dispute with a rival Detroit rap group. The 28-year-old star could have gotten up to five years in prison.

"Poor judgment is an understatement for what you did," Circuit Judge Denise Langford Morris said.

Eminem, who has come under fire for his violent and anti-gay lyrics, was accused of pulling a 9mm semiautomatic gun in a Royal Oak parking lot during an argument last June with associates of the rap group Insane Clown Posse.

Get Breaking News Delivered to Your Inbox

Witnesses said Eminem did not point the gun at anyone, and the rapper said it was not loaded. He pleaded no contest to charges of carrying a concealed weapon and brandishing a weapon.

"You are extremely lucky, sir, that no one was injured or killed," the judge said.

Eminem walks away after meeting with a Michigan judge on Monday, April 23, 2001. CARLOS OSORIO/AP

Defense attorney Wally Piszczatowski said his client was happy with what he called a fair sentence.

"He's very pleased that the judge treated him like (she) would treat any other citizen ... rather than sentencing him due to celebrity status," Piszczatowski said. "He's just happy that the criminal cases are over."

Prosecutor Mark Bilkovic had asked the judge for jail time. "I'm still satisfied with what she did," he said. "She's going to be holding a hammer over his head for the next year... If he screws up one time, she'll be on him."

Eminem skyrocketed to fame with the hit song, "The Real Slim Shady," with the refrain, "Will the real Slim Shady please stand up?" Poking fun at the song, the judge said, "Mr. Mathers. Now is the time for you to please stand up."

The rapper did not speak at the sentencing other than to respond to a question from the judge with "No, ma'am."

Eminem was ordered to pay more than $2,300 in fines and court fees. The judge also ordered Eminem — whose real name is Marshall Bruce Mathers III — to perform community service, telling him to submit his idea for community service within 21 days.

The requirement was it has to be something creative that would be "impactful to young people," the judge said.

Earlier this year, Eminem pleaded guilty to a separate weapons charge and received two years of probation. In return, prosecutors dropped an assault charge stemming from an incident, also last June, in which Eminem was accused of pistol-whipping a man seen kissing his wife outside a nightclub.