Although the month is a holy time meant for introspection, peace and piety, it has been transformed in the hands of the extremists

Receive the latest national-international updates in your inbox

In this Sunday July 3, 2016, file photo, an Iraqi woman grieves at the scene after a truck bomb attack in Karada, a busy shopping district in the center of Baghdad, Iraq. As millions of Muslims around the world celebrate the end of Ramadan, many are struggling to come to grips with what has been a particularly bloody month of attacks that killed more than 350 people and spread terror across continents.

As Muslims around the world celebrate the end of Ramadan, many are struggling to comprehend a wave of attacks that killed 350 people across several continents during the holy month and made urgent the question of what drives the militants to ever more spectacular violence against civilians.

The diverse, high-profile targets — including one that struck the heart of Islam in the month's final days — underline the warnings of many experts: the Islamic State group, especially when on the defensive at home, will metastasize far beyond its theater of operations.

The extremist group has always sought attention and recruits through brazen terrorism. The projection of daring, operational competence and utter disregard for the norms of its enemies has proven a winning strategy among its disenfranchised and angry followers around the Muslim world.

But having lost the key city of Fallujah in recent weeks, capping a series of setbacks in Iraq, the group is pushing to project strength while also diverting attention from its battlefield humiliations.

"ISIS is waging an existential fight," said Fawaz Gerges, a London-based scholar of jihadi groups, using an alternate acronym for the militant group. "The future of the Islamic State is on the line, and it is trying to maximize the cost for its adversaries and also to inspire this particular segment of young men and women who subscribe to its ideology."

If the militants needed to send a message, the onset of Ramadan provided a convenient context.

Although the month is a holy time meant for introspection, peace and piety, it has been transformed in the hands of the extremists who have thrived during the recent decades of turbulence around the region, particularly in war zones like Iraq, Afghanistan and more recently in Syria.

Although the vast majority of the faithful regard Ramadan as a time for prayer and forgiveness, militant Muslims and hard-line clerics have been touting the month as a time for victory in jihad, or holy war.

Weeks before Ramadan, IS called for its supporters to strike wherever possible. In a digital age where statements on the internet quickly proliferate, those calls appear to have found resonance among some circles of disenchanted Muslim youth around the globe.

From Omar Mateen, who pledged allegiance to IS as he shot and killed 49 people at a crowded gay nightclub in Orlando on June 12, to the militants who killed 44 at Istanbul airport, to the young men who killed 20 hostages at a popular restaurant in Bangladesh on July 1, such violence highlights how radicals across the world can carry out attacks that are instantly attached to IS, even when the Syria- and Iraq-based group does not formally claim responsibility.

They also underlined the increasingly blurred lines in which attacks, even those stemming from local grievances, could be assigned to IS and be transformed into a global cause. The bloodshed, targeting Muslims and non-Muslims alike, also demonstrates the difficulty in neutralizing a threat that is often inspired and not necessarily directed.

Still, many of the attacks appeared to have involved careful planning, spaced out with targets clearly meant to induce fear and shock across continents.

In Yemen, where suicide bombers and other militants carried out at least seven simultaneous attacks in the southern port city of Mukalla against security targets on June 27, 43 people were killed. In one of the attacks, a bomb was concealed in a box of food brought to soldiers at a checkpoint to break their dawn-to-dusk Ramadan fast.

In the capital of Bangladesh, where attackers killed 22 people at a popular restaurant in an upscale Dhaka neighborhood frequented by diplomats and foreigners, witnesses said the attackers tortured some of the hostages before killing them for failure to recite from the Quran.

In Baghdad, residents hardened by years of war said the July 3 bombing was like no other, trapping shoppers in an inferno of fire that killed at least 175 people in one of the deadliest single attacks since the 2003 U.S.-led invasion.

"This is a second Hiroshima and Nagasaki," said Ammar al-Khafaji, a 50-year-old local from Karada district of Baghdad, where the attack happened. His son lost three of his friends in the bombing.

The wave of attacks culminated Monday with triple suicide bombings in Saudi Arabia, including one outside the Prophet's Mosque in the city of Medina, one of the holiest sites in Islam that killed four security troops. The nature of the attacks and their apparently coordinated timing suggested the Islamic State group could be to blame, although no one claimed responsibility.

The attacks come as the IS group is increasingly on the defensive in both Syria and Iraq. Its hold on territory has shrunk in both countries, after losing key strongholds, including the Iraqi city of Fallujah.

Ibrahim Bayram, a Beirut-based political analyst, said the attacks aim to dispel the notion that the organization is going to vanish or shrink.

"With such attacks, it is proving that it is still capable of crossing borders and conducting attacks" everywhere, including in the holy sites in Saudi Arabia, he said. That is a key for the group, which seeks to boost its credentials and recruitment.

The attack in Medina outside the sprawling mosque grounds where the Prophet Muhammad is buried, however, sparked particular disgust. Millions of Muslims from around the world visit the mosque every year as part of their pilgrimage to Mecca. Across social media and on channels used by the Islamic State group, supporters appeared to be grappling to explain or come to terms with the attack, quickly labeled by opponents as an attack on Islam itself.

Mohammad Ballout, writing in Lebanon's daily As-Safir newspaper on Tuesday, said the attacks in Jordan, Turkey and Saudi Arabia aim to send a direct warning to the Sunni-led nations that the undeclared truce with them may collapse if they don't revise their strategies toward IS and halt their support for the war on the group.

Gerges said the Medina attack was not surprising. "There are no red lines anymore," he said.

It is also possible that the radicals are seeking to goad the U.S.-led coalition arrayed against them to take them on in their strongholds of Raqqa in Syria and Mosul in Iraq.

Those are the prizes, yet the Iraqis seem reluctant to move on their second-largest city, lost two years ago. In Syria, there is almost no ground war to speak of: with the coalition reluctant to ally with the government of President Bashar Assad, it has sufficed with air power, leaving the fight on the ground to Kurdish militias and smaller groups. The two cities offer the prospect of a bloody, house-to-house fight that many jihadis calculate would be worth losing, if only because it would cost their enemy so dearly.