The man cannot be named until he has tendered a plea in relation to the rape charge.
Minutes after the man left the court to walk to his car with his attorney, he allegedly came under attack.
His attorney Reial Mahabeer told TimesLIVE that a woman, who was protesting outside court, allegedly slapped his client and threw rocks at him.
'One of the rocks missed his head by centimetres while the other hit him on the hand. I spoke to my client and at this stage we are not going to open a case of assault."
The protesters dispersed after the alleged incident and couldn't be reached for comment.