Chris Brown has settled his custody battle.

The court decided the 'Loyal' hitmaker and his former lover Nia Guzman should share physical and legal custody of their daughter Royalty.

Expressing his excitement about the decision, he wrote: ''Court went great today. Glad this all worked out. ... Sending my thank you to my legal team. I'm so happy with OUR outcome today! #ILoveMyZillahAndRoyalty #ParentsFirstBullshitLast #WeLoveRoyaltly. (sic)''

The court handed Chris, 26, 12 days a month of no supervised visitation, and confirmed he will be responsible for paying Nia $2,500 a month as well as a total of $15,000 in support overdue, gossip website TMZ reports.

Meanwhile, a source previously claimed Chris is desperate to give up partying for the sake of Royalty.

They said: ''Chris is weening himself off drinking and other stuff he does because he wants to be healthy, have a clear mind, and be a completely conscious and sober parent. He doesn't want anyone or anything clouding his mind or judgement.

''He wants to witness every little single thing Royalty does with a clear mind. He wants to fill his mind with sober memories of her doing the smallest things like tying her shoes, being potty trained, you name it. His life and world is now Royalty and everything else that doesn't serve that he's cutting out!''