The gay father of a two-year-old boy living with his lesbian mother and her partner has won the right to be involved in his life in a landmark ruling that could have significant implications for "alternative families".

Judges at the court of appeal ruled that the couple's desire to set up "a two-parent lesbian nuclear family" might be "essentially selfish and may later insufficiently weigh the welfare and developing rights of the child".

The decision to have a child can never be a matter of "dry legal contract" and the father's right to play a role in his son's life must be recognised, ruled the judges.

Observing that "human emotions are powerful and inconstant", Lord Justice Thorpe said the father was "seeking to offer a relationship of considerable value" to his son.

"It is generally accepted that a child gains by having two parents. It does not follow from that that the addition of a third is necessarily disadvantageous," he said.

The boy's mother argued that the father of the child had agreed over a meal in a restaurant that the lesbian couple would be the boy's "primary parents" but had later changed his mind.

The earlier decision of a family court judge that the father should have a "limited relationship" with the boy was overturned by three high court judges on Wednesday.

The lesbian couple – described as "professional women of considerable achievement" – said they felt "bitter and betrayed" after the boy's father asked for overnight and holiday contact with his biological son.

The boy's father, a London-based professional in his 40s, known only as "A" for legal reasons, went through a "marriage of convenience" with the boy's mother – known in court as B – to make it easier for the couple to have a child. But after the child was born the three parents disagreed about the extent of the father's future relationship with the boy.

Limited to seeing the boy once a fortnight, the father – formerly a close friend of the couple – took his case to the appeal court.

There, Lord Justice Thorpe, Lady Justice Black and Sir John Chadwick upheld his challenge and ruled that a family judge had made "a fundamental error" by trying to lay down a general rule to limit the future relationship. Decisions about the father's role should be made "by stages in the light of accumulating evidence", they ruled.

In their judgments, the judges described how B and C were both "naturally delighted" when A offered to be a sperm donor.

B had entered into a "marriage of convenience" with A in July 2007 because her religious family – who had difficulty accepting her sexuality – did not want her to have a child out of wedlock.

The court heard that the couple intended to be primary carers, with A "welcomed and acknowledged" as the child's biological father, but "otherwise his relationship with his son would be purely secondary".

But by April 2009, just months before the birth, A stated he wanted "overnight contact at his home once a week from birth augmented by an annual holiday". When M was born in September 2009, A was present at his birth, attended his christening and joined early discussions about the child's education. But A's intention to be part of his son's life disturbed the couple's vision "of being a core family in which they will provide M with a secure and loving home" and threatened their relationship, the court heard.

When M turned one, his father applied for a defined contact order. The couple applied in response for a joint residence order. At a high court family division hearing in July last year, Judge Jenkins increased slightly the duration of A's existing contact with M from five to six hours once a fortnight. But the judge agreed A's role in the child's life should be limited and "secondary" – to the extent that the child should know who his father was, but not so much as to "fracture" the lesbian couple's "nuclear family".

A joint residence order was granted to the couple, giving parental responsibility to C, the mother's partner.

Lady Justice Black observed that the courts were continuing to struggle with what was "still new territory", but said it was "an area of family law in which generalised guidance is impossible".

• This article was relaunched on 16 March 2012 after some legal amendments.