Updated

A wave of Islamic State bombings in Baghdad has killed nearly 100 people in two days, exposing lingering gaps in the capital's defenses, which are manned by an array of security agencies and militias that don't always cooperate.

The attacks also point to the resilience of the extremist group, which has increasingly resorted to bombings in civilian areas far from the front-lines as it has lost territory to Iraqi forces backed by U.S.-led airstrikes.

Three attacks in Baghdad on Wednesday left more than 90 people dead and 165 wounded. The deadliest struck a crowded market selling food, clothing and household goods in the predominantly Shiite neighborhood of Sadr City. The second deadliest attack in Baghdad this year was also in Sadr City, where bombings in late February killed 73 people.

On Thursday, two suicide bombers hit a police station in Baghdad's westernmost suburb of Abu Ghraib, killing five policemen and wounding 12.

Bombings have been a fixture of life in the Iraqi capital since the 2003 U.S.-led invasion that toppled Saddam Hussein, with the attacks reaching their peak during the sectarian fighting of 2006 and 2007, when dozens of civilians were killed nearly every day.

Security has improved since then, but at the ubiquitous checkpoints in and around the capital, security forces still use electric wands that have been repeatedly discredited, and security is often handled by armed groups that are allied with the government but also loyal to political parties or militias.

Shortly after the Islamic State group swept across northern and western Iraq in the summer of 2014, top Shiite clerics called on volunteers to mobilize to defend the country. The call-to-arms gave security forces a much-needed influx of thousands of men, but also hastened the rise of powerful militias that often act independently.

The Shiite militias officially operate under the direct command of the prime minister through an umbrella group known as the Popular Mobilization Forces, but command and control remains decentralized. In Baghdad, they operate alongside federal and local police, intelligence agencies and different army divisions.

"There is a multitude of security forces and no higher authority coordinating them," said a senior Iraqi intelligence official, who spoke on condition of anonymity as he was not authorized to brief the press. He said the failure to share intelligence was largely to blame for the recent attacks.

Prime Minister Haider al-Abadi's office said he "ordered an immediate investigation to find the reasons that led to these security breaches and called for greater accountability for negligence."

The statement said IS was trying to "compensate for defeats on the battlefield and the victories of the country's armed forces."

Security began to improve last year as Iraqi ground forces backed by U.S.-led airstrikes started wresting territory back from IS. The Iraqi government estimates that IS only controls around 14 percent of the country, but the extremists still hold Mosul, the country's second-largest city, and Fallujah, a city just west of Baghdad.

Experts say that as the group's territorial losses have mounted it has changed tactics, reverting to an earlier strategy of using large bombs to target security forces and Iraq's Shiite majority, aiming to stoke sectarian strife and undermine faith in the Shiite-led government.

The bombings point to a "weakening ability of the (Iraqi security forces) to adequately and consistently protect the greater Baghdad area," the Institute for the Study of War said in a recent report.

The bombings also show that IS is "a hybrid enemy that can shapeshift from a semi-conventional force into its roots as a terrorist organization," Kimberly Kagan, the president of the Washington-based think tank, told The Associated Press.

In addition to defending the capital from IS, Iraq's security forces have also had to contend with mass protests in recent weeks led by a firebrand Shiite cleric demanding wide-ranging political reforms. Thousands of followers of Muqtada al-Sadr breached Baghdad's heavily guarded Green Zone last month and ransacked parliament, though they later withdrew from the area peacefully.

Iraq's Interior Ministry, which oversees the police, linked the recent IS attacks to the political turmoil, saying the country faces a "serious challenge" and that the public needs to rise above "grudges and revenge."

Support for al-Sadr runs deep in Sadr City, a vast Shiite working class neighborhood named for his family, which has seen the deadliest bombings this year.

Hundreds gathered at the site of Wednesday's attacks calling for increased security and for the interior and defense ministers to resign.

"The political bickering, the differences and conflicts among politicians are hurting (the country) at all levels," said Baghdad resident Raad al-Quraishi, who blamed the political stalemate for the security failures and a deepening economic crisis.

The anti-government protests first erupted last summer as temperatures soared and millions were left without electricity. With the approach of another sweltering summer, a spike in bombings could stoke even greater unrest.

Protesters returned to the streets of Sadr City on Thursday, with many blaming the attacks the day before on the government.

"We demand also that the prime minister step aside," in addition to the defense and security officials, Sabah Yasen said. "They should pay heed to their people who are killed daily. We hold them responsible."