Retired NBA player Matt Barnes won custody of his 10-year-old twins on Thursday, concluding a bitter battle with his ex-wife Gloria Govan.

In addition to physical and legal custody, the 37-year-old also secured a 18-month restraining order against Govan that will be in effect until May 2020.

While the restraining order is for Barnes, it is not extended to his children as it is believed that Govan doesn't pose a threat to them.

Matt Barnes has won sole physical and legal custody of his twins - Isaiah and Carter - from his ex-wife Gloria Govan

Govan, 33, will get to see her children on regular visits, TMZ reports. She'll get to see Carter and Isaiah every other weekend from Friday until Monday morning.

In addition to physical and legal custody, the 37-year-old also secured a 18-month restraining order against Govan that will be in effect until May 2020

Govan - who had brief stints on VH1's Basketball Wives and Basketball Wives LA - will also get to eat with her children on Wednesday evenings.

Holidays such as Christmas, Thanksgiving and New Years still need to be negotiated between the two.

A judge also ordered Govan to undergo 26 sessions of anger management and 10 parenting classes.

Govan was arrested on the Friday before Labor Day after the former Los Angeles Lakers player claimed that she flew into a rage in her car, preventing Barnes and their twins from leaving their school.

Govan, 33, was arrested for child endangerment.

She denied the allegations and prosecutors did not bring criminal charges against the woman.

The restraining order does not extend to the children

Govan (left) was arrested on the Friday before Labor Day after Barnes (right) claimed that she flew into a rage in her car, preventing Barnes and their twins from leaving their school

The former couple are seen above on the show. Govan is now engaged to another former LA Laker Derek Fisher

Barnes was accompanied by his lawyer, Samantha Spector, in the courtroom on Thursday. He posted a photo on Instagram thanking the lawyer for her help.

The couple tied the knot in 2012 and split two years later, Their divorce was finalized in 2016.

Govan is now engaged to another former LA Laker Derek Fisher.