Banners mark control of territory and identify units as they have for thousands of years, but in Iraq they also show the sharp religious and ethnic divisions among combatants, including some on the same side.
"In Iraq today, you can say there is a war of bullets and... flags. These two are inseparable," said Ahmed Ali, an expert at the Washington-based Institute for the Study of War.
"Psychologically, planting your flag is very significant. It tells your enemy that you are in the area and develops a character and identity for any organisation," Ali said.
It is also "an important morale-boost and can also be a morale-crusher when it's taken down," he said.
In Iraq, where pro-government forces backed by US-led air strikes are battling to recapture territory from the Islamic State (IS) group, flags have taken on particular symbolism.
IS militants fly black banners with the first half of the Muslim testament of faith – "There is no god but God" – written in white, and a white circle with the words "God, Messenger, Mohammed" that is said to have been the Prophet Mohammed's seal.
IS "uses its flag to portray itself as synonymous with religion: they say that since their flag has the name of God on it, anyone who burns or desecrates it is an enemy of God," said Nathaniel Rabkin of the Inside Iraqi Politics newsletter.
Iraq's multi-fronted conflict now involves soldiers and police, Kurdish peshmerga fighters, Shiite militiamen and predominantly-Sunni tribes, who sometimes cooperate but in other cases fight their own independent battles.
Shiite banners usually hung up during the annual Ashura commemorations and subsequent 40-day period of mourning for Imam Hussein, one of the most revered figures in Shiite Islam, are frequently flown from both checkpoints and vehicles by federal troops and militiamen.
The Iraqi national flag still flies at government buildings, bases and elsewhere, but it is vastly outnumbered by the religious banners, many picturing a black-bearded Imam Hussein with a green cloth covering his head.
With Iraqi federal forces crumbling under the weight of the IS-led drive, Baghdad turned to Shiite militias to bolster troops.
DUELLING RELIGIOUS REFERENCES
Signup to our newsletter and follow us on Facebook and Twitter!
"Some Shiite militias have been trying to exploit the Shiite tradition of Ashura banners, using these banners to mark territory or to portray their cause as identical to that of Hussein," said Rabkin.
According to Shiite belief, Hussein willingly sacrificed himself in opposition to the Caliph Yazid's un-Islamic and unjust rule, facing his army with just a few dozen followers.
There are also flags representing specific militias that are heavy on Shiite symbolism, including Zulfiqar, Imam Ali's two-pointed sword.
The IS flag features prominently in the group's propaganda videos and photos it posts online, including a series of shots that showed gunmen massacring captured members of the Iraqi security forces earlier this year.
The jihadists have also paraded through areas under their control with the black banner flying from vehicles.
Aymenn al-Tamimi, a fellow at the Middle East Forum who is an expert on jihadist groups, said that the flag "is important to IS as a marker of its distinct identity."
Romain Caillet, a French expert on jihadist movements, noted that the flag was launched by IS's predecessor the Islamic State of Iraq, but has been adopted as a symbol by jihadist groups around the world.
When pro-government forces recapture areas from IS, the group's flags are taken down, and they are keen to show off captured banners.
In one case, IS used that against them, rigging one of its flags with explosives that killed three policemen in northern Iraq when they tried to remove it.
In Syria, where IS also holds significant territory, its fighters have exposed themselves to enemy fire to plant the group's flag on hilltops near the besieged town of Kobane, close to the Turkish border.
Iraqi Kurdish peshmerga forces fly the flag of their autonomous region, to which they directly report – red, green and white with a golden, multi-rayed sun at its centre.
"Raising flags is an important factor in the battle," a peshmerga colonel said. "The flag is the foundation of victory."