BAGHDAD — At checkpoints across Baghdad, soldiers have defied a recent order from the prime minister to remove Shiite religious flags and replace them with Iraqi ones. At schools in the northern city of Kirkuk, students have raised Kurdish flags. And in the southern port city of Basra angry citizens have designed their own flag, anchored by the image of a single drop of oil.

Then, of course, there are the black flags of the Islamic State, the extremist group in control of about a third of the country.

Perhaps not since modern Iraq was created nearly a century ago by the fusion of three Ottoman provinces — Basra, Baghdad and Mosul — have more people challenged the idea of Iraq as a unified state.

Even as the new government is scrambling to defeat the militants of the Islamic State, also known as ISIS or ISIL, it faces an underlying challenge that may be tougher: promoting a new sense of national identity that, even if it cannot transcend the differences between Sunni and Shiite, Arab and Kurd, at least basically holds them together as countrymen.