A New York City judge has awarded custody of a three-year-old boy to a gay man who had been raising him, the Detroit Free Press reports.

The man and his partner had been battling for the boy with the man’s boss, who had served as the child’s surrogate mother.

Supreme Court Justice Marylin Diamond ruled that the evidence showed that the mother never intended to raise the child. The mother is reportedly considering an appeal to the decision, and has been allowed to visit the boy twice a week and have overnight visits every other weekend.