As the fight for the Iraqi city of Mosul drags on, many might ask: Why has it taken the combined militaries of the United States and Iraq backed by an international coalition more than two years to dislodge a relatively small force of militants lacking heavy weaponry?
Donald Trump raised the question during his campaign, promising to turn up the heat against the Islamic State group if he became president. Now the growing controversy over the high number of civilian casualties believed caused by recent U.S. airstrikes has touched on a major part of the answer: The militants are mingled among tens of thousands of civilians in Mosul and are willing to take the population down with them.
Inevitably, the more force brought to bear to crush the fighters, the greater the danger civilians will be killed.
To avoid that, strikes must be more surgical and more cautiously used, and the battle turns to street-by-street fighting where the technological edge is often neutralized. Minimizing civilian deaths is more than just a humanitarian concern: Heavy bloodshed can fuel public resentments that push some to join militant groups.
Another factor is whether the extremists have support from at least part of the population. It's even further complicated if they can claim to be fighting for national liberation - as, for example, with the Hamas group in its battles with Israel in Gaza. In Iraq and Syria, the Islamic State group clearly holds the population hostage in many cases, but it also seeks to sway some support by claiming to defend Sunnis against a mostly Shiite force from Baghdad.
After a March 17 explosion that residents say killed at least 100 people in Mosul, the U.S. military acknowledged an airstrike was involved. But the top commander of U.S. forces in Iraq said investigations may reveal a more complicated explanation, including the possibility that militants rigged the building with explosives after forcing civilians inside.
Army Lt. Gen. Stephen Townsend said recent civilian casualties in Mosul were "fairly predictable" given the densely populated urban neighborhoods the IS fighters are defending against Iraqi troops.
Over the past two-and-a-half year, Iraqi forces backed by U.S. special forces and coalition airstrikes have managed to push IS out of most of the territory they overran in the summer of 2014 - retaking three major cities and numerous smaller communities. The fight for Mosul, launched in mid-October, has been the longest battle yet.
With each fight, the Islamic State group has adapted its use of civilians as human shields, creating increasingly deadly battlefields.
In Tikrit and Sinjar, IS let the population flee early on, allowing Iraqi and coalition forces to liberally use airstrikes and artillery to retake the areas by the autumn of 2015.
IS then tightened its grip on other cities and towns. It locked down Ramadi in western Anbar province with checkpoints to prevent civilians from fleeing. Only those with serious health conditions were allowed out - and only if they left behind a relative, property or thousands of dollars to guarantee their return.
After Iraqi forces punched into Ramadi, fleeing IS fighters forced civilians to go with them to thwart airstrikes. Moving west along the Euphrates River, Iraq's military responded to the use of human shields by largely empting towns of their populations as they retook territory. The massive displacement resulted in humanitarian crises. Thousands were left without shelter and little food or water in desert camps.
So the government changed tactics. It asked civilians to stay in their homes, a decision that was controversial with commanders faced with clearing militants from dense residential areas.
In Mosul, an estimated 1 million people were in the city when Iraqi forces breached its eastern edge. IS fighters fired from the rooftops of homes where civilians sheltered, targeting those who fled with mortars and gunfire. In denser neighborhoods, even precision munitions inflicted heavy casualties. In western Mosul, IS fighters forced civilians into explosives-rigged homes, then took up positions on the roofs, Iraqi and coalition officials said.
A similar battle looms in the Islamic State group's Syrian stronghold of Raqqa.
There, the militants have taken even greater pains to trap the population. Land mines and checkpoints circle the city. And all the men have been ordered to wear the jihadis' garb of baggy pants and long shirts, making it difficult to distinguish militants from civilians.
Here are other cases where advanced militaries have wrestled with the issue.
The United States
The U.S. has faced backlash over civilian deaths in nearly all its recent conflicts - Korea, Vietnam, and more recently Iraq and Afghanistan. Public fury in Iraq and Afghanistan over deaths in airstrikes and at checkpoints and abuses by U.S. troops has been a major factor shaping the evolution of U.S. tactics since 9/11. The response has been to turn increasingly to special operations forces and armed drones and to work with local fighters.
In Iraq from 2005 to 2007, the more secretive elements of U.S. special operations, led by Lt. Gen. Stanley McChrystal, combined intelligence with night raids to capture or kill insurgents, including the leader of al-Qaida in Iraq, Abu Musab al-Zarqawi. This - and the enlisting of Sunni tribesmen to fight the insurgents - proved far more effective than conventional forces kicking in doors.
Still, drone strikes that kill civilians continue to raise an outcry in Yemen, Pakistan and elsewhere.
And militants also evolve. Al-Qaida in Iraq was all but extinguished by 2009, but a kernel of militant leaders who met in U.S.-run prisons transformed it into the Islamic State group by exploiting Iraq's Sunni-Shiite divide, which worsened after U.S. forces left in 2011.
Russia in Grozny
The Russian assault on the Chechen capital, Grozny, in 1999 and 2000 was the centerpiece of President Vladimir Putin's drive to end Chechen separatist ambitions.
It was also a case of a military - and government - that seemingly cared little about how much destruction it wrought to crush the rebels. Russian forces unleashed heavy bombardment with artillery and airstrikes that leveled apartment buildings and even city blocks. Most of the population had fled but a significant number remained. There was an international outcry over the brutality, but public opinion in Russia strongly backed the assault, giving Putin freedom of action.
It took just four months before Putin declared Grozny liberated in February 2000. Thousands of civilians are believed to have been killed, and the United Nations called Grozny the "most destroyed" city in the world.
Israel in Gaza
The Israeli military knows the challenges of fighting an enemy embedded in a civilian population. Wars against Hezbollah in Lebanon in 2006 and against Hamas in Gaza in 2009, 2012 and 2014 killed hundreds of civilians. Israel blames its adversaries for the tolls, noting they used civilian areas to hide or to attack from.
The Israeli military says it takes numerous steps to minimize civilian casualties. It drops leaflets telling residents to leave. It makes phone calls and sends text messages to inhabitants of targeted buildings and sometimes strikes homes with nonexplosive shells as warnings to evacuate.
According to the United Nations, 2,251 Palestinians, including 1,462 civilians, were killed during the 2014 Gaza fighting, including 551 children and 299 women. Israel disputes these figures. A U.N. report accused both Israel and Hamas of committing possible war crimes.
France in Algeria
As France's empire was coming undone in the 1950s, it fought its most brutal battle for one precious piece of turf: Algeria, colonized beginning in 1830. The war to hold onto Paris' crown jewel lasted seven years, 1954-1962, and left scars that have yet to heal.
The conflict, which began as an insurgency and continued with urban terror-style attacks on the French, was ferocious. Some Algerian lawmakers still call for reparations. The toll remains debated, but a leading French historian says 350,000-400,000 Algerian civilians died.