Rapper Coolio has avoided jail after he admitted carrying a concealed gun at Los Angeles International Airport.
The US musician was arrested after the handgun was discovered in his bag during security screening on September 17.
Coolio, whose real name is Artis Leon Ivey, pleaded guilty to carrying a concealed firearm as a felon when he appeared at Los Angeles' Airport Courthouse on Wednesday.
He was sentenced to 45 days community service and banned from owning or possessing guns during a three-year probation period.
Speaking outside the courtroom, Coolio said: "A mistake was made. It was a misunderstanding.
"I don't condone the use of firearms, illegal or legal.
"Thanks to the court and the attorneys for handling this for me.
"I was very worried.
"I don't do crime. I'm not into anything illegal."
Coolio had faced a maximum three-year prison sentence after he was originally charged with one count of possession of a firearm by a felon with two prior convictions.
The charge was waived by prosecutors after Coolio agreed to enter a guilty plea to the lesser charge.
The 53-year-old has previous convictions for carrying a concealed weapon in a vehicle in 2001 and possession of cocaine base in 2009, prosecutors said.
Police said at the time of his arrest that the confiscated gun was loaded.
Coolio is best known for his 1995 hit Gangsta's Paradise. He also appeared on Celebrity Big Brother in 2009 and Ultimate Big Brother in 2010.
Judge Keith Schwartz said Coolio had appeared in front of him before, commenting that the rapper's distinctive hairstyle was "different".
"It suits you I guess," the judge said.
A list of weapons that Coolio was banned from owning or possessing while on probation included handguns, rifles, shotguns, machetes, tear gas, pepper spray and ammunition, the court heard.
Addressing the rapper, Judge Schwartz said guns seemed to "follow you around".
"You need to stay away from these things," he added.
"One bullet is a violation of your probation.
"Having illegal guns is not something you need.
"Please do value your probation because if you don't, you will be making a lot of new friends."
Coolio had already served one day in a county jail following his arrest, the court heard.
His conviction will be reduced from a felony to a misdemeanour if he completes his first year of probation successfully.