A High Court judge has told of the "terrible" price families can pay when parents have affairs which result in the birth of children and "secrets lie hidden".
Mr Justice Williams aired his thoughts after a 40-year-old woman asked him to rule that her mother's former boss was her father.
He said it was alleged that the pair had an affair in 1977.
The judge said infidelity had generated an "iceberg of emotional cost".
Detail of the case has emerged in a ruling by the judge following a private hearing in the Family Division of the High Court in London.
He has not identified anyone involved.
Mr Justice Williams granted the woman a "declaration of paternity" following the death of her mother's former boss.
The woman's mother's husband had been registered as the father when the woman was born in 1978, said the judge.
He discovered that "his daughter was not in fact his" a decade later.
His marriage to the woman's mother ended soon afterwards.
The woman was said to have discovered the "secret" at the age of about 20 when her brother told her during a row that the man she thought was her father was not her father.
Her mother, her mother's former boss's widow and representatives of his estate had become embroiled in litigation.
"The background to this application and the way the case has been litigated and the dynamic in court all too graphically illustrate the terrible personal costs paid by everybody involved, but particularly children, when parents embark in extramarital relationships which lead to the conception of a child and when secrets lie hidden for decades," said Mr Justice Williams in his ruling.
"The pain and anger that has been revealed in court ... is undoubtedly only the tip of a huge iceberg of the emotional cost that ... infidelity has led to."
He added: "The experience of this court is that humans err, people make poor choices. Sometimes that creates a momentum which builds until it is way beyond anything they could have contemplated and way beyond their ability to control."