After recording the suspect’s statements, the court ordered the 24-year-old Chadian national named Abu Shams to remain under police custody until the completion of judicial procedures and a verdict is handed down.

The Taif branch of the Commission for the Promotion of Virtue and Prevention of Vice (Haia) handed Shams to police last Friday.

The Haia said it arrested the man after receiving a complaint from a 17-year-old student, who alleged that Shams played football with him and became his friend before dragging him to the furnished apartment where he raped him.

The Haia did not reveal the name or nationality of the student, who claimed the rapist forced him to walk around naked in the room so he could film him using his mobile phone.

The student said Shams kept the recording and threatened to post it online if the victim did not sleep with him.

The Haia said its members arrested Shams while he was on his way to his apartment. A spokesman said he had more than 150 pornographic video clips on his mobile phone, including one featuring the student.

It is alleged that Shams also used to write his name on government buildings, walls and bridges.