It's been a long and ongoing battle for Chris Brown and his baby mama Nia Guzman over their 1-year-old daughter Royalty, but the 26-year-old rapper has finally gained a huge victory. Earlier today in a Houston court, Brown officially gained joint custody of Royalty, TMZ reported.

Guzman was trying to deny Brown of any custodial rights and wanted him to only be able to see her through supervised visits, but the judge decided the parents would share 50/50 physical custody.

Since the two both now live in Los Angeles, Royalty will go back and forth between them every four days. Brown will also keeping paying $2,500 a month in child support to Guzman instead of the $15,000 she was fighting for. The judge also asked that Guzman stop publicly speaking poorly of Brown and to not reveal anything about the case on social media.

At first, TMZ had reported that Brown was not in attendance at the hearing, but he posted a photo with his lawyers to assure that he was in fact there. 

It hasn't been an easy battle for Brown as Guzman has been putting up a nasty fight. Prior to Friday's hearing, her attorney Carl Anthony Moore had high hopes that she would win the case. "Nia's feeling good about [the hearing]," he told Hollywood Life. "We're hoping the issues that are of concern to her will be completely resolved." Luckily for Brown, he was able to prove he's a good dad and got everything he wanted out of this.

It wasn't until earlier this year that Brown even found out he had a daughter, as HNGN previously reported. In July, he filed the legal documents to gain this custody since Guzman was making it difficult for him to see his daughter. 

"For me, there comes a time where people have to grow up and start becoming more of an adult and taking responsibility, and I think this was just a blessing in disguise with my daughter," Brown told Ryan Seacrest in June. "I get a chance to like look at her and, you know, teach her stuff, the right path, and also be a father in my daughter's life. Just to see the smile on her face, just to see the littlest things, it's emotional for me. So I just love that aspect of being able to be a father now."