Bro don’t be obtuse. It was illegal to be gay in Britain as recently as 1981 in some parts. British colonial rule had a profound effect on the countries it held dominion over particularly in introducing laws which often held harsher punishments than at home in order to “civilize” the local people there. As other commenters have mentioned, homosexuality was not nearly as taboo in the Middle East during the days of the Ottoman Empire as it is today. Many countries which were under British rule still maintain harsh anti homosexuality laws today, the harshness of which can be traced back to the introduction of British law codes.
Kind of brain dead not to realize Iraq was a British mandate after World War I, 100 years ago. They did upend the bureaucratic systems following the fall of the Ottoman Empire and instituted sweeping new laws.