(Getty)

For the first time an Italian court has legally recognised a child born to a gay couple.

The ruling by the Turin court means the birth of the child, conceived by artificial insemination, and born in Barcelona, should be written into official records in the town where the couple live.

It is being held up as a challenge to the lack of same-sex marriage in Italy.

The ruling allows the child, who was born in 2011, can have Italian citizenship, and that they can live in Italy with their Italian mother, who is now divorced from her Spanish wife.

Joint custody was previously awarded to the couple by a Barcelona court.

The ruling was issued in October, but was made public on Wednesday. It overturned a previous ruling from 2013, that the birth could not be recognised in Italy.

According to the court, the ruling acted “exclusive interests of the child, who has been brought up by two women which the [Spanish] law each recognises as its mother.”

The names of the couple, and of the child were omitted in court records.