Matt Barnes scored a big win in court today against his ex-wife Gloria Govan -- the court awarded him sole physical and legal custody of their twin 10-year-old boys ... TMZ Sports has learned.
The two have been at war for years -- and today, Matt obtained an 18-month restraining order against Gloria claiming she's a physical danger to him.
The restraining order was granted through May 2020 -- but does not extend to the kids because the judge doesn't believe Gloria poses a danger to them.
During Thursday's hearing, the judge ruled Gloria will get regular visitation -- including every other weekend from Friday until Monday morning. She is also allowed to have dinner with the kids every Wednesday evening.
The two are still working out the custody arrangements for the holidays including Christmas, Thanksgiving and New Years.
As part of Thursday's hearing, the judge also ordered Govan to complete 26 sessions of anger management and 10 parenting classes.
Matt was accompanied in court by his attorney Samantha Spector.
TMZ previously reported, Gloria was arrested the Friday before Labor Day after Matt claimed she put the lives of their twin boys at risk by allegedly flying into a rage in her car, blocking Matt and the kids from driving away from their school.
Gloria denied the allegations and ultimately prosecutors declined to press forward with criminal charges.