An injunction banning the media in England and Wales from reporting the identity of a married celebrity who allegedly took part in a threesome has been lifted.

Court of Appeal judges accepted the Sun On Sunday's bid to lift the injunction, but said the celebrity could still not be named pending a possible appeal.

The judges said the allegations had now been widely reported abroad and online.

They gave the man time to apply to take the case to the UK Supreme Court.

In the ruling, they said there must be no publication leading to disclosure of the celebrity's identity before 13:00 BST on Wednesday.

The celebrity - who has young children and whose spouse is also well-known - has until 10:00 BST on Tuesday to submit arguments to the Supreme Court.

It will then decide whether to hear the case - and therefore extend the reporting ban - or to throw it out, leading to the order being lifted.

Analysis

Clive Coleman, BBC legal correspondent

We had no right to privacy in the UK until we got the 1998 Human Rights Act.

Suddenly we got Article 8 of the Act - and people had a right to protect their privacy.

That led to a battle royal between rich and powerful people who wanted to protect their privacy, and the tabloid press, armed with the right to freedom of expression, who wanted to write about it.

We have seen this drama played out through a number of cases, notably the Ryan Giggs injunction case five years ago.

Today, the Court of Appeal has effectively acknowledged that there really is a recipe for melting privacy injunctions.

Once information comes in to the public domain online and via foreign publications, the whole purpose of the injunction has then been defeated and the claimant can no longer show that they would win a final injunction at an eventual trial.

Tabloid editors will be cracking open the champagne. If this judgement stands, it looks like the end of the celebrity privacy injunction as we know it.

The man - known in court as PJS - took legal action earlier this year after the Sunday tabloid newspaper tried to publish allegations about him.

Monday's judgement said the celebrity had "occasional sexual encounters" with another person - referred to in court as AB - starting in 2009.

According to the judgement, they had a text message exchange in December 2011 in which they discussed a "three-way".

"Accordingly the three met for a three-way sexual encounter, which they duly carried out", the ruling stated.

In January, the two other parties approached the Sun On Sunday with the story.

Two Court of Appeal judges later imposed an interim injunction, which prevented PJS being named in England and Wales.

Confidentiality 'lost'

However, lawyers for News Group Newspapers - publishers of the Sun On Sunday - asked judges to lift the ban.

They said stories had been published in the US, Scotland and elsewhere - where the injunction does not apply. It had also spread across the internet and on Twitter.

Lord Justice Jackson said he had to balance PJS's right to privacy against the newspaper's right to freedom of expression.

The judges ruled that PJS was now unlikely to be able to claim a permanent injunction.

Their ruling on Monday stated details about the allegations were now "so widespread" that confidentiality had "probably been lost".

The man's solicitors had been "assiduous" in monitoring the internet and removing stories in breach of the injunction, the judges said, but added it was a now "hopeless task".

"Much of the harm which the injunction was intended to prevent has already occurred," Lord Justice Jackson said.

"The court should not make orders which are ineffective."