A man's attempts to maintain contact with his son suffered a "huge set-back" when a picture he had taken of his "private parts" was "somehow" sent to his bisexual ex-partner, a High Court judge has said.
Mr Justice Holman described the sending of the "obscene text photograph" to the toddler's mother as an "incredibly unfortunate event".
The judge said the man had texted the "very private" photograph to another woman he had been "sexting".
But he said the boy's mother, and her female partner, must have thought that it had been deliberately sent to them.
He said the upshot had been that the man had "effectively" had no further contact with his son, who is approaching his second birthday and lives with his mother and her female partner.
Detail of the incident has emerged in a written ruling by the judge following a hearing in the Family Division of the High Court in Leeds.
The man had asked for an order that he should have contact with his son despite opposition from the boy's mother and her female partner.
And Mr Justice Holman ruled in the man's favour.
He said the welfare of the child was "paramount" and the little boy had to have contact with his father.
No-one involved was named.
Mr Justice Holman said the man and his ex-partner made contact arrangements in the months after the little boy's birth. And he said contact took place "largely amicably".
Then contact broke down for reasons that were "not entirely clear".
He said the pair may have "got over that temporary hitch" but for the "incredibly unfortunate event" of the sending of the photograph.
"(The man) had taken a photograph of his own private parts, which he had sent by text to some woman otherwise unconnected with this case, to whom he says he was 'sexting'," said Mr Justice Holman.
"Somehow, and the route is completely unknown, that very private but obscene text photograph got sent to (the boy's mother).
"She accepts that (the man) did not himself send it to her. He says that he is completely unable to explain how it got from the woman to whom he sent it to (the boy's mother) but obviously it was deeply shocking to (her) and no doubt to (her female partner), to receive that picture.
"For a while, at any rate, they must have believed that (the man) had sent it deliberately directly to them, and it proved a huge setback to the resumption of contact. In the upshot, there has been no contact between (the man and his son) effectively now for a year."
But he said the man had to be allowed the chance to have a relationship with the little boy.
"This is, I am afraid to say, one of those cases where all the difficulty lies between the parents," added the judge. "There must be contact."
Mr Justice Holman said the woman and her female partner started living together about nine years ago.
In 2010 the woman met the man via an internet dating agency.
He said the woman and the man had an "on/off" relationship until at least late February 2011.
They had then had sex in the summer of 2011, when their son was conceived.
But Mr Justice Holman said the man and woman disagreed about their "intentions" when they had sex in the summer of 2011.
The man said they were still in an "on and off" romantic relationship.
He said he had been keen to father a child "with whom he could have some relationship".
But the woman said any romantic relationship with the man had ended by the summer of 2011.
She said the "sole reason" the man had been "invited or permitted" to have sex with her in the summer of 2011 was so that he could be a "sperm donor".
She said the man had agreed to "walk away".