Allam's comments, which were part of a discussion about moderate Islam, are a historic milestone for Egypt's religious institution. Along with the grand imam of al-Azhar mosque, the grand mufti of Egypt holds one of the highest positions on religious authority and plays an important role in determining opinions on religious law.
Allam noted that other religious communities in Egypt, such as the Coptic Church, have also condemned homosexuality but say gays and lesbians should be treated fairly.
The interview comes amid a crackdown on Egypt's gay community, which has led many people to hide their identity because of fear of being arrested or harmed. Activists have expressed concern about a wave of arrests targeting people alleged to be gay or transgender, including seven transgender people who were celebrating a friend's birthday in February 2015 and 11 allegedly gay men accused of prostitution in September.
"Egyptian authorities routinely subject allegedly gay men arrested for 'debauchery' or 'insulting public morals' to forced anal exams, which amount to torture," the Human Rights Watch 2016 world report said.
Egypt does not have a specific law banning homosexuality. But a 2013 Pew Research Center study found that 95 percent of people surveyed in Egypt believe homosexuality should be rejected.
Allam, who took the position of grand mufti in 2013, is widely known for his moderate views, and his comments on homosexuality come in stark contrast with other religious authorities in Egypt.
Imam Sheikh Ahmad Al-Tayyeb, who leads the al-Azhar mosque in Cairo, said during a local television interview in June, that "no Muslim society could ever consider sexual liberty, homosexuality to be a personal right. Muslim societies consider these to be a disease that has to be fought and treated," according to the Middle East Media Research Institute, which posted a video of the interview online.
According to the Egyptian Initiative for Personal Rights, over the past few years, police have been monitoring websites and social media used by the LGBT community in Egypt, including Grindr, a gay dating application, and have set up fake accounts to entrap individuals.
"You have to be aware of everything you're doing; your clothes, your reactions toward people," a gay Egyptian told CNN, declining to reveal his name. "I'm always afraid if I meet someone and he is from the government than I'll get arrested like other people."