Actor Jason Patric is celebrating after a California judge ruled he is the legal father of his four-year-old son Gus.

The Speed 2: Cruise Control star has been locked in a two-year legal battle with his ex-girlfriend Danielle Schreiber over the parentage of Gus, who was conceived via artificial insemination.

Schreiber initially succeeded in banning Patric from gaining access to his son, based on California law that grants the mother full custody unless there is a written agreement establishing parental rights before conception.

However, the actor challenged the ruling and earlier this year (14), officials at a California appeals court granted him permission to claim parentage of the kid.

The case recently returned to court, where a judge declared in Patric's favour and ordered the two sides to work out a custody deal between themselves, reports

If Patric and Schreiber fail to reach a mutual agreement over custody, visitation and child support, the judge will make the decision for them.

The actor has previously won the support of celebrity pals including Ben Affleck, Matt Damon, Mel Gibson, Jon Hamm, Chelsea Handler and Kiefer Sutherland, who all attended his first annual Stand Up For Gus fundraiser in Los Angeles.

The event was held to raise money for fathers struggling to see their kids during nasty custody battles.