Funnyman Chris Rock was accused of having underage sex with a girl - as a practical joke.
The comedian - who is currently touring in South Africa - was duped by rumours he was about to be arrested for sexually assaulting a minor in Britain.
But the arrest was a hoax and was being filmed by a U.S reality TV programme.
National Prosecuting Authority spokesman Tlali Tlali says, "They pulled one on him, information got to him that the South African Police Service was going to arrest him.
"Acting on that information he quickly approached lawyers who brought an urgent application at the Johannesburg High Court where judgement was in his favour.
"This one went far, it must have been organised quite carefully."
A spokesman for Rock was unavailable for comment.