Image copyright AP Image caption William Marotta

A Kansas man who donated sperm to a same-sex couple is not legally the child's father and cannot be forced to pay child support, a court has ruled.

William Marotta, from Topeka, answered a classified ad in 2009 from two women who wished to have a child.

The couple later separated and the birth mother received state assistance.

The state's department for children and families, however, had sought to recoup costs and force Mr Marotta to pay ongoing child support.

County District Judge Mary Mattivi ruled that the birth mother, Jennifer Schreiner, and her former partner, Angela Bauer, should be considered the child's legal parents.

Mr Marotta was paid $50 (£40) for each donation and the insemination occurred at the women's home with a syringe. He has had very limited contact with the child and never intended to provide financial support.

Ms Bauer is unable to work and is receiving disability payments.

The department for children and families filed a petition to have Mr Marotta declared the child's legal father in 2012, seeking to reclaim expenses related to the child's birth, plus ongoing child support payments.

A Kansas law says a man who provides donated sperm to a doctor for an insemination is not the child's parent, unless there is a written agreement to the contrary.

However, the department had argued that Mr Marotta was legally obliged to pay because a doctor had not been involved during the insemination.

A department spokesperson said the law pertaining to sperm donors was "clear and was ignored in this ruling". The department has not yet said if it plans to appeal.