Lil Uzi Vert took a plea deal in an assault case involving his ex-girlfriend and fellow rapper SAINt JHN ... and he's avoiding time behind bars.
The Los Angeles County District Attorney's Office tells us Lil Uzi Vert pleaded no contest in court to one count each of felony assault with a firearm and misdemeanor injury to a girlfriend.
We're told he was sentenced to 3 years of formal probation, 1 year of treatment for mental health and substance abuse, 52 weeks of domestic violence counseling, restitution and a 10-year criminal protective order.
Lil Uzi Vert copped the plea deal after prosecutors charged him with 3 felonies -- assault with a firearm, criminal threats and domestic violence -- plus a misdemeanor charge of carrying a loaded firearm.
TMZ broke the story ... Uzi's ex, Brittany Byrd, filed a police report back in July claiming Uzi put a gun to her stomach and then hit her.
Remember ... the alleged incident went down at Dialog Cafe in West Hollywood, where Lil Uzi Vert jumped out of a Cadillac Escalade and confronted JHN, leading to a physical altercation.
At the time, sources connected to Brittany told us she was discussing a business project with SAINt JHN when Uzi rolled up and confronted everyone at their table before getting into it with JHN.
As we reported, the sources said Uzi threw a punch at JHN but missed ... and when Uzi fell down his gun fell out on the ground. We were told that's when Brittany got up from the table and approached Uzi and he allegedly hit her and pushed the firearm into her stomach.
Prosecutors followed through with criminal charges and Lil Uzi copped a plea.
We reached out to Uzi's camp ... so far, no word back.