A British man stumbled upon his ex-wife’s infidelity in an unusual way – through a medical exam - and found out he wasn't the biological father of their three sons.

When Richard Mason’s doctor informed him in 2016 that he had cystic fibrosis, he also noted that his patient was unable since birth to have biological children because of the condition. The infertility came as a shock to Mason, who had – or thought he had – produced three sons with his ex-wife, to whom he’d been married 20 years.

He had raised them since 1995, believing they were his own. But they were the children of a former coworker of Kate Mason, with whom she’d had a four-year affair, according to the Daily Telegraph.

"You don’t know what’s real and what isn’t. It's as if I’m living in 'The Matrix.'” Mason told the Daily Mail. “Someone says to you, 'All that you know and everything you thought to be solid and true is not real, and never did exist. You are not a father, you are not able to have kids, your name will not continue.'"

Mason, who is a 55-year-old founder of the comparison site moneysupermarket.com, sued his ex-wife, demanding the roughly $5.8 million he paid her in their 2008 divorce settlement. He also wanted the matter of paternity fraud addressed, though it is unclear in what manner.

His ex-wife has agreed to settle but as long as she doesn’t need to name the children’s biological father.

Richard Mason’s counsel, Roger Terrell, said to the Telegraph: “I think it was the major reason for her settling. I was shocked and surprised that she settled, I thought we were going to have a very acrimonious court battle.

“We were confident that we would get a court order whereby the ex-wife, the mother of the children, would have to name the father.

“She didn’t want to name the father - why, we don’t know - that is why she came to a financial settlement and in the settlement she did not have to name the father.”

Richard Mason very much wants the biological father to identify himself, so that the children know who he is, the newspaper said. But a source whom the newspaper described only as “close to the family” said the sons are not interested in knowing about him.

The source, according to the Telegraph, said Mason’s public statements about his ex-wife had shocked those who knew the couple. “I assume the natural father, whoever he is, has not made any contact and no doubt doesn’t even know they exist.”

His ex-wife revealed she had an on-and-off affair with the boys’ biological father, having the first child in 1995 and the other two, who are twins, in 1999.