The man donated sperm so his gay friend could have a baby more than a decade ago. (Representational)

A man who donated sperm so his gay friend could have a baby more than a decade ago must be recognised as the girl's father, Australia's High Court ruled Wednesday.

The court said because the man was listed on the birth certificate and had an "extremely close" relationship with the child, he was a parent and should have a say in whether she is taken to live in New Zealand.

The man -- known in court papers by the pseudonym 'Robert Masson' -- agreed to give his sperm to a friend of decades in 2006 via artificial insemination.

Masson had expected to play a part in the girl's parenting and despite their not living together, he had "an ongoing role in the child's financial support, health, education and general welfare", the court said.

The girl -- now around 12 years old -- and her sister had both called Masson "Daddy", although the second girl was not his biological daughter.

Problems arose when the girl's mother and her same-sex partner wanted to move to New Zealand in 2015.

Judge Margaret Cleary ruled that a lower court was wrong to rule against the father and concluded that the child should remain in Australia, so he is able to see her.

The case has been the subject of a series of back and forth judgements as it worked its way up to the High Court, including legal wrangling between courts over the correct application of state and federal law.

Cassandra Seery, an associate law lecturer at Deakin University, said the ruling could have implications for thousands of couples, but only if both parents are involved in raising the resulting child.

"The extension of the definition of 'legal parent' to a sperm donor may initially appear to be far-reaching, (but) the implications of this decision are limited," she wrote in a commentary.

"The High Court has arguably taken a common sense approach by recognising that any person -- including a sperm donor -- who is found to be taking on a parental role should share in the responsibilities of raising a child."

"This decision does not open the door to custody battles from anonymous sperm donors who have never seen or had a relationship with their biological child."