Exclusive

Rapper Blueface can breathe a sigh of relief ... he will NOT be prosecuted in his felony gun case ... TMZ has learned.

Blueface appeared in an L.A. court Wednesday afternoon where a court official tells us his case was tossed due to insufficient evidence. That's obviously great news for the rapper ... who had his suspicions about the case from the get-go.

Play video content 02/02/2019

TMZ broke the story ... Blueface claimed the LAPD targeted him because he's black. LAPD had initially said they were in DTLA patrolling an area ravaged by burglaries and they were there to offer protection. The concern, cops said, was that there were robberies in that area by gang members and cops were worried the rappers were easy targets.

LAPD had said Blueface and several others scattered and tossed their guns when they saw cops arriving ... but Blueface from the start called BS. His lawyer said Blueface was never in possession of a firearm.

Bottom line ... it's now case closed.