A police officer saw rapper Lil' Wayne hiding a gun on his tour bus after a New York show, a court has heard.
Officer Diane Hornung told a pre-trial hearing she got on the tour bus in July 2007 because she smelled marijuana.
She said that, on the bus, she saw the rapper, real name Dwayne Michael, trying to hide a bag with a gun in it.
Lil' Wayne has pleaded not guilty to illegal gun possession. His lawyer says the charge should be dismissed because police had no reason to stop the bus.
The officer said police had pulled over the bus after it had left the Manhattan concert.
Asked by the judge why she had boarded the bus, which she said had about 15 people on board, she replied: "Because I smelled marijuana and I saw someone peeking through the curtain."
She said that, after ordering everyone off, she walked to the back of the bus, opened a bathroom door and saw a man trying to flush a plastic bag with marijuana in it down the toilet.
After confiscating the marijuana, she then found Lil' Wayne sitting in a bedroom wearing his underwear and trying to hide a bag, she added.
She said that, when he got dressed, she looked in the bag and found a loaded .9mm handgun.
If found guilty of illegally possessing a gun, the rapper faces up to four years in prison.
Lil' Wayne's lawyer, Stacey Richman, said police stopped and boarded the bus "without probable cause" and, therefore, the case should be dropped.
Diane Hornung acknowledged that she had not seen anyone smoking marijuana and Lil' Wayne was not charged with possession of the drug.
Lil' Wayne sold more than a million albums in a week in the US in June, with his sixth record Tha Carter III.