Omar Mateen has been identified as the gunman in the mass shooting at a gay nightclub in Orlando this weekend. (Myspace via Reuters)

This weekend, Omar Mateen walked into Pulse, a popular gay nightclub in Orlando, and fatally shot 49 people before being killed by police. During the attack, Mateen pledged allegiance to the Islamic State, an extremist organization that has waged a relentless campaign against gay people in Syria and Iraq. The shooting appears to be one of the worst acts of homophobic violence in modern history.

Now, new developments suggest that Mateen's motivations may not have been as simple as they seem. Witnesses have come forward to say that he had been to the club many times before. Others say he was often seen on gay dating apps, on which he contacted other men. Some former classmates and others have openly suggested that Mateen himself was gay.

For the Islamic State, that would appear to pose a quandary. The organization — which is sometimes referred to as ISIS or ISIL — is known for its brutality against LGBT people in the Middle East, often killing those accused of homosexuality by throwing them off buildings or stoning them. Witnesses say the Islamic State goes through the phone and social media accounts of people it believes are gay to find more people to target. "They are trying to track down every gay man," one young gay Iraqi told the BBC last year. "And it's like dominoes. If one goes, the others will be taken down, too."

Yet, before the reports of his alleged links to Florida's gay community appeared, the Islamic State rushed to embrace Mateen as one of its own, even though there is no evidence that it was directly involved in planning the attack. Islamic State media have derisively referred to Pulse as a "nightclub for sodomites" and deemed Mateen a heroic "lone wolf" in the fight against the West.

Analysts say they doubt that the Islamic State or its supporters will engage in any real discussion of Mateen's sexuality. Generally, supporters of jihadist movements tend to ignore reports of their leaders' sexual conduct if they disagree with it, says Aymenn Jawad al-Tamimi, a research fellow at the Middle East Forum and an expert on the Islamic State. Tamimi points to the case of the late Anwar al-Awlaki, an American citizen who became a figurehead for al-Qaeda's affiliate in Yemen but was known to visit prostitutes during his time in the United States.

"They live in their own bubble wherein they can believe only what they want to believe about idolized terrorists," says Rita Katz, director of the SITE Intelligence Group.

"Mateen is already a huge hit with the fanboys, so he's not going away at this point," J.M. Berger, a researcher who closely follows the Islamic State's online supporters, said in an email. If they did acknowledge the reports about his sexuality, Berger says, they would have two options: deny or rationalize.

The first option seems to be happening already, to an extent. On Tuesday, one Twitter account sent out messages with links to Western reports about Osama bin Laden having an extensive pornography collection and Salah Abdeslam, a key figure in Islamic State attacks in Paris and Brussels, having frequented gay bars. The implication seemed clear: The West is trying to discredit extremist figures with false reports that implied sexual hypocrisy.

Hassan Hassan, co-author of "ISIS: Inside the Army of Terror," agreed that many supporters of the group would seek to ridicule Western reports about Mateen. However, he added, they will be able to find a theological rationalization for Mateen's purported actions, too. "It's easy for the group to justify it as he pledged allegiance to the group, which ISIS takes to mean he converted to true Islam, and as per Islamic teachings 'converting to Islam abrogates everything before it,'" Hassan said in an email. Mateen's pledge of allegiance to Islamic State leader Abu Bakr al-Baghdadi — during a 911 phone call made while the nightclub attack was ongoing — would negate past actions deemed sinful. "So they'd say he converted to Islam and so his sins were annulled," Hassan said.

The Islamic State has been especially open to accepting pledges of allegiance from individuals with whom it has had little or no direct contact, even if their backgrounds would be troubling for the group. Tamimi and Berger note that the Sunni extremist group even embraced a man who took hostages in Australia in 2014, Man Haron Monis, despite his Shiite religious background, criminal record for sexual assault and bizarre work history, which included reports of "black magic."

For the Islamic State, embracing individuals who commit violent acts and then pledge allegiance to Baghdadi serves a clear purpose: It makes the group look more powerful than it actually is, able to pull off attacks in a variety of locations with little centralized planning. And for the individuals who pledge allegiance to the Islamic State, the benefit is just as clear. They get to wipe the slate clean, gaining the respect and praise of Islamist extremists all around the world — no matter what their past looked like.

More on WorldViews

How the Islamic State exploits America’s mass shooting problem

Omar Mateen may not have understood the difference between ISIS, al-Qaeda and Hezbollah

The Islamic State’s shocking war on gays