The name of the restaurant where the offences took place was permanently suppressed.
Abdulrahman was finally caught on July 24.
The victim asked him for directions to the toilets and the defendant obliged, before following the man inside.
Abdulrahman entered the cubicle next door and made his move.
"Whilst holding a cellphone in one hand, the defendant stood on the toilet and pointed [it] over the cubicle and videoed the defendant's genitals as he was urinating," a police summary said.
Realising what was happening, the victim informed the restaurant manager and police were called.
The extent of Abdulrahman's crimes, stretching back to November 2020, only came to light when officers analysed the device.
While the defendant was unable to offer an explanation for his actions, his counsel Sarah Saunderson-Warner set out his turbulent background.
Born in Yemen, Abdulrahman came to New Zealand in 2013 where he was granted refugee status.
"His sexuality in that country is punishable by death," Saunderson-Warner said.
The defendant had studied at a tertiary level which led to employment in the hospitality industry, the court heard.
Since the offending was uncovered, Abdulrahman had received treatment from a psychotherapist and was seeing a GP for depression and anxiety.
Saunderson-Warner said he was motivated to continue that course.
"This clearly was an invasion of privacy, it was a breach of trust in a generalised way. The public expect to be able to go to the bathroom in public venues without this sort of thing happening," Judge Flatley said.
Abdulrahman was sentenced to four months' community detention and 12 months' supervision.
The judge ordered the destruction of the phone used to make the recordings.