In December 2011 PJS sent AB a text message asking if CD was "up for a three-way". AB said that CD was, and the trio met for and had a three-way sexual encounter.
After that encounter, the sexual relationship between PJS and AB ended, although they remained friends.
Early in 2016 AB and CD told the editor of the Sun on Sunday about their earlier sexual encounters with the claimant.
When PJS was told that the newspaper intended to publish a story, he launched an application for a gagging order.
His application was rejected by Mr Justice Cranston, who accepted that PJS and his wife had put many details of their relationship into the public domain, and that it was in the public interest that the newspaper should publish an account of his sexual exploits with others.
But while rejecting the application, Mr Justice Cranston issued a temporary injunction to allow PJS to appeal, which he did, arguing that the judge had incorrectly carried out the balancing exercise between his right to respect for privacy and family life under Article 8 of the European Convention on Human Rights, and the newspaper's Article 10 right to freedom of expression.
Lord Justice Jackson said he had concluded that there were two significant shortcomings in the decision of Mr Justice Cranston which allowed the Court of Appeal to intervene.
The first was that while the judge had identified the Article 8 rights PJS's children as a relevant consideration, he had not explained how he had taken those rights into account.
The second was that the judge had found that in various publicity material PJS and YMA had portrayed an image of commitment, and had accepted that commitment might not entail monogamy, but had then said that there was a public interest in correcting the image which the couple portrayed.
But on the present evidence, PJS and YMA were a committed couple and had been for a long time, said Lord Justice Jackson, adding: "On the evidence of both of them, the claimant's occasional sexual encounters with others do not detract from that commitment."
One issue was whether press articles and similar material shown to the court went further than simply portraying commitment.
"In my view the picture which emerges from the publicity material is not one of total marital fidelity, but rather a picture of a couple who are in a long term, loving and committed relationship. On the present evidence, that image is an accurate one," said Lord Justice Jackson.
"If the defendant publishes the proposed story, this will not set the record straight in any material respect. It will simply reveal that one feature of the claimant's and YMA's long term relationship is that the claimant is allowed to have occasional sexual encounters with others.
That would provide supplementary information, but it would not correct a false image."
He went on: "I accept that the claimant is a public figure. This therefore exposes him to comment and criticism in the media."
But as the Strasbourg court had observed, kiss-and-tell stories "about a public figure which do no more than satisfy readers' curiosity concerning is private life do not serve the public interest".
Lord Justice Jackson went on: "The right to freedom of expression includes the right to say or publish matter which others may find offensive, heretical or unwelcome. Freedom of expression is an important right for its own sake."
But he rejected the newspaper's argument that there was a relevant public debate in progress, and that the Sun on Sunday's proposed story would contribute to that debate, saying: "In my view, the information which it is proposed to publish will not advance the public debate or provide support for any of the competing opinions which are in circulation."
He accepted that the newspaper was entitled to publish articles criticising people in the public eye. But while the newspaper had Article 10 rights to publish an account of PJS's adultery, he had an Article 8 right for his sexual liaisons to remain a private matter.
"The proposed story, if it is published, will be devastating for the claimant," said Lord Justice Jackson.
"In my view on any proper balancing exercise, the claimant's Article 8 right to privacy must prevail over the defendant's article 10 right to publish an account of the adultery."
There was also the position of the children to consider – the proposed article would generate a media storm and much public interest in PJS's family, and their children would become the subject of increased press attention, with all that that entailed.
He was satisfied, said Lord Justice Jackson, that when the action came to trial, PJS was likely to establish that publication should not be allowed.
The court granted an interim injunction restraining the defendant from publishing the proposed article until trial or further order.