A man in Saudi Arabia has been arrested for flying the rainbow flag at his home.

The doctor, who lives in Jeddah, apparently didn’t know the flag represented LGBT+ pride.

He says he bought the flag online after one of his children said they liked the “pretty” design, reports CNN.

The religious police in Saudi, known as the Committee for the Promotion of Virtue and the Prevention of Vice, came to the man’s home after he raised the flag three metres on a pole.

The doctor was later bailed after an “investigation”, but did agree to remove the flag.

Saudi Arabia criminalises homosexuality, and it is punishable by death.

Earlier this yer a hashtag in favour of a discussion on LGBT+ rights went viral in Saudi, but many responses to it were with threats of violence.

In January four couples were arrested in Saudi just for being in same-sex relationships.

Popular Saudi Arabian YouTubers earlier this year posted a shockingly homophobic video to YouTube – which was eventually removed for hate speech.

The clip was uploaded by Fe2aFala – popular Arabic vloggers who have more than 500,000 subscribers, racking up over 45 million views.

In a shocking video uploaded to the video site, the young men rant about “Deviant marriage in Riyadh”, apparently after a local raid of a ceremonial gay wedding.

They added: “We would like to thank the police for beating their asses.”