Justice Eleanor King Tuesday granted a residency order to care for the child to the non-birth mother of a three-year-old boy, the Daily Telegraph reported.
The situation began when the non-birth mother and her then-husband asked a close family friend to be "artificially inseminated at home" with the husband's sperm to have a child, instead of going through a licensed and regulated fertility clinic.
Following the birth, the couple had a falling out and divorced. To complicate matters, the couple missed the six-month time limit they had to seek court recognition of the woman's parenthood and she ended up with no parental rights. The couple was not eligible for adoption after they divorced.
Although the judge's residency order does not make the non-birth mother a legal parent of the child, she will be able to have joint custody with the father.
The surrogate mother is listed as the child's mother on his birth certificate.
King called the couple's case a "cautionary tale" that underlines the "real dangers" of entering into illegal surrogacy contracts.