PARIS -- It took just a few hours for the Islamic State group's opportunistic propaganda machine to capitalize on the latest bloodshed in Florida and in France, with messages claiming the two attackers as its own. It may take the group longer to sort through the implications of a killer whose backstory of conflicted sexuality and heavy drinking is at odds with a carefully crafted public image of its fighters.

But whether the links were direct or merely aspirational, they were enough to thrust IS to the centre of the U.S. presidential race and the debate over the role of Islam in the world. They were enough to cause France to re-examine who should be expelled over links to extremism.

The group's apocalyptic message is aimed as much at Muslims living in the West as it is at non-Muslims, hoping to persuade an undecided audience to adopt its extremist views -- and reject Western ideals of pluralism and tolerance, preferably with bombs and bullets. Facing defeat on the battlefield, it is taking victories where it can find them.

The attack on a gay nightclub in Florida by an American-born Muslim during Ramadan and the stabbing of two police officials in France two days later would initially appear to dovetail perfectly with that worldview. Omar Mateen's killing of 49 people at the Pulse nightclub in Orlando tapped into deep fears that extremists are lying in wait to prey upon the West at home -- fears that Islamic State fans at every available opportunity.

"The uncomfortable reality is that attacks such as the one in Orlando become 'Islamic State attacks' simply because the attackers declare them as such. The validity of their assertions matters less than the consequences of their actions," according to an analysis Tuesday by the Soufan Group security consultancy. "Mateen may have sought to catapult his reputation from that of a homophobic mass-murderer to a 'soldier of the caliphate,' merely by parroting the group's name."

President Barack Obama said Mateen was inspired by the group's Internet propaganda, and during the attack, Mateen called 911 to offer allegiance to Islamic State.

"With the tyrants closing the doors of migration, you should open the doors of jihad, and let them regret it," Islamic State spokesman Abu Mohammed al-Adnani said in a message late last month directed to Muslims living in the West.

But Mateen's messy life shows the hazards for an extremist group that hinges its credibility on its faith. Pulse customers have described him as a regular at the gay nightclub, someone who drank heavily and could be disruptive when intoxicated. Islamic State has reserved one of its most gruesome methods of killing for suspected gays -- throwing them to their death from rooftops. Alcohol is banned in the group's territory, and anyone caught with it gets whipped, lashed or fined.

"ISIS is under pressure, hence more willing to take the risk of being proven wrong," said Michael Horowitz, a senior analyst with the Levantine Group, using an alternative acronym for the group. "By blindly claiming Mateen ... ISIS loses control over the narrative, a control that has been a top priority for the group thus far."

Already, there was a backlash on Twitter following reports that Mateen was probably a closet gay who drank alcohol. Critics ridiculed the image of a homosexual Islamic State "soldier." Some coloured the black IS flag with rainbow colours. One post included a picture of a trim Mateen looking in his cellphone, reading sarcastically: "It seems love grew and Mateen turned to Daesh and then used his gun" to express it. A defender went on to belittle such reports saying there were claims after Bin Laden's death that the al-Qaida leader was a pornography fan.

The stabbing in France of a couple who both worked for French police bears the hallmarks of the Islamic State group's call to arms against the symbols of the West. The suspected killer, 25-year-old Larossi Abballa, had a background in jihad: A 2013 terrorism conviction in a network that sent people to Pakistan.

In a Facebook video that he filmed during the France attack, Abballa puzzled over what to do with the three-year-old child of the two police officials he had just knifed, according to a police official with knowledge of the investigation. The official spoke on condition of anonymity for lack of authorization to discuss the footage.

A Facebook profile bearing the name Larossi Abballa -- which vanished from the Internet early Tuesday -- showed a photo of a smiling, bearded man. Two recent posts featured videos critical of Israel and Saudi Arabia. The last post publicly available was a mock-up of the European Championship logo highlighting the posters' purported masonic and occult symbols.

"Some will say we see evil everywhere!" Abballa said in a message posted about 18 hours before the attack. The Paris prosecutor said he had a list of targets, including journalists and public figures, and had said he was responding to the Islamic State calls to attack during Ramadan.

Abballa and Mateen are dead. It will be up to investigators to pick apart their links to the extremist organization.

When Islamic State claimed responsibility for the Nov. 13 attacks in Paris and the March 22 attacks in Brussels, it offered details on the assailants and the killings -- and a clear indication that the killers were under its command. In the case of the latest attacks, the links are murky at best but that may matter little for a group that is seeing defeat on the battlefields of Iraq and Syria, and is increasingly desperate to highlight any victory.

In both cases this week, Islamic State's Amaq news agency cited a "source" claiming each was carried out by one of its fighters -- leaving a shadow of a doubt the group normally avoids. But the attackers in France and the United States adhered to the basics of what Islamic State demands of its followers, which is a public declaration of support, said Horowitz, the analyst.

Beyond that, for Islamic State, anything can be a win if it's played right. A six-minute propaganda video emerged Monday produced by Torgman al-Asawirti, an Islamic State-linked Twitter user, a compilation that ends with the Orlando shootings and a tribute to Mateen: "He took a decision and immersed himself among the crusader Americans and responded."