Lesbian, gay, bisexual, and transgender (LGBT) people in Afghanistan face legal challenges and discriminations not experienced by non-LGBT residents. Afghan members of the LGBT community are forced to keep their gender identity and sexual orientation secret, in fear of harassment, intimidation, persecution, violence, and the death penalty. The religious nature of the country has limited any opportunity for public discussion, with any mention of homosexuality and related terms deemed taboo. Legality of same-sex sexual activity Islamic Republic of Afghanistan The Islamic Republic of Afghanistan (which governed most of Afghanistan's territory until 2021) was vague in regards to homosexuality laws; although not directly illegal, it could be punished by unofficial Sharia courts or by related crimes, such as extramarital sex. Penal Code The Penal Code of 1976 was reinstated after 2001, and it had several provisions that could have been applied to LGBT people. Article 398 – Offers lesser punishment for vigilante honor killings, which may involve a family member discovering their spouse or kin engaging in adultery, fornication or homosexuality. Article 427 – Prescribes long prison terms for adultery and pederasty, the latter may be interpreted as including sodomy, in light of the fact that there are still legal punishments prescribed even if the people involved are legal adults. The maximum punishment increases if victim is under eighteen years of age, if the defendant is in a position of authority over the victim, if the defendant has repeatedly committed the crime or if the crime results in the spread of a disease. The law also increases the available punishment if a "violation of honor" takes place. Article 512 states that a person who is engaging in public "watching" in a repugnant manner shall be imprisoned or fined. This Penal Code was replaced by the Penal Code Of 2018. Sharia law The Constitution stipulated that Afghanistan is an Islamic republic, so it was possible for LGBT people in Afghanistan to be charged with violating Sharia law. This could have happened happen in lieu of, or in addition to charges being brought under the penal code. Sharia law based punishment was more likely to occur in isolated, rural communities where private citizens and vigilant groups sought to punish anyone who does not follow strict Islamic morals. In the cities, persons convicted of homosexuality were generally sentenced to prison. In 2004, an American advisor to the Afghanistan government was arrested and sentenced to