A man in Saudi Arabia has been arrested for flying a rainbow flag at his home, CNN Arabic reported.

The man, who is a doctor from Jeddah, a commercial and coastal metropolis in Saudi Arabia, was unaware the flag symbolised LGBTIQ pride.

Participating in or showing support for homosexuality is not only illegal in the country, but is punishable by death.

The man purchased the flag online after his children found its colours to be "pretty".

Shortly after, Committee for the Promotion of Virtue and the Prevention of Vice, the Saudi religious enforcement body, arrested the doctor at his home.

The doctor faced an "investigation" by the committee, but was later released on bail after agreeing to take down the flag.

Earlier this year, an Arabic hashtag encouraging discussion of LGBTQI rights in Muslim states went viral in Saudi Arabia. The hashtag translated to "Respect Gay Rights".