Stefan Connolly, from Deramore Drive in the Strathfoyle area of the city, appeared in court charged with doing a provocative act during the parade, disorderly behaviour, obstructing a police sergeant and with possessing the Class C drug Viagra.
A police officer told Deputy District Judge Austin Kennedy that the defendant ran off when he was approached by officers after he shouted "Up The Ra" at a Loyalist band during Saturday's parade.
The officer said Connolly ran through the Richmond Shopping Centre and down Shipquay Street followed by police officers who eventually caught him hiding among a group of tourists walking along the city walls.
She said that she believed that the defendant's "Up The Ra" comment was a hate motivated crime.
When he was searched in Strand Road police station following his arrest, police found a green tablet on the defendant which he said was "Viagra which had been given to him by a friend earlier in the day".
Applying for bail, defence solicitor Ciaran McGuinness described Connolly's behaviour as stupid.
"He says he shouted it for a bit of craic and then stupidly tried to evade the police. It was not his intention to cause a disturbance. He was simply acting the big man in front of his friends and he had ended up in court," he said.
Mr Kennedy refused bail because he believed there was a high likelihood of the defendant re-offending and he remanded him in custody until 5 September.