What's up with Nouri al-Maliki? As security anxieties subside in this slowly calming city, political speculation has rarely been so intense. First, it was Maliki's demand that all US troops leave Iraq by the end of 2011. Then came signs that his government wants to undermine the Sunni tribal militias, known as the Awakening councils, on whom the Americans have relied to defeat al-Qaida in Iraq. Now there are moves to take on the powerful Kurdish peshmerga troops and push them out of disputed areas in the strategic central province of Diyala.

Why is the prime minister doing this? Is "the puppet breaking his strings", as one Arab newspaper put it? Or is the more appropriate metaphor "dropping the mask"? Those who knew Maliki in exile in Syria during Saddam Hussein's time now recall that he opposed the US-led invasion. His Daawa party did not attend the eve-of-invasion conference of US- and UK-supported exiles in London, and he opposed the party's decision six months later to join the hand-picked "governing council" set up by the first occupation overlord, Paul Bremer.

Maliki's new line has discomforted the Americans. Some officials put on a brave face, saying it is a sign of Iraqi confidence in their own sovereignty, a development that, of course, they support as proof that the Bush administration's strategy of rebuilding a proud country is succeeding. Others say it reflects overconfidence, even hubris, as Iraq is a long way from being able to survive without US military protection.

Either way, playing the nationalist card has huge potential consequences in Iraq. With provincial and parliamentary elections expected next year, it will sharpen the struggle for dominance in the Shia community. It is designed to undercut the appeal of the radical cleric Moqtada al-Sadr, a consistent opponent of the occupation who is re-profiling his movement on the lines of Lebanon's Hizbullah. Its Mahdi army militia will be slimmed into a group of experienced resistance fighters, kept in reserve for action against US troops rather than to fight Iraqi Sunnis, while the rest of the movement goes into communal politics.

Posing as the nationalist who managed to get the US to accept a timetable for withdrawal (the tense negotiations could yet founder) allows Maliki to distance himself from his main Shia allies in government, the Islamic Supreme Council of Iraq (ISCI), seen as keen backers of the occupation. It also diverts attention from the chronic power cuts and other economic troubles. Every government has to fight on its record in office, but, by turning himself into a patriotic Iraqi hero, Maliki may sidestep this. Some observers suggest he may even go to the elections on a "prime minister's list", to redefine himself as no longer a Shia or a political Islamist, so as to win support from Iraq's secular and non-sectarian urban middle class. But there are uncomfortable echoes here of the effort by Ayad Allawi, the prime minister appointed by the US in 2004, to project himself in the December 2005 elections as a strong man. His vote total fell a long way below his expectations.

But if Maliki wants to present a new image as a man who stands up to the Americans, why does he choose this moment to go after Sunnis and Kurds? The principle of disarming all militias, and not just those of his Shia rivals, such as Sadr, may be laudable but the timing is highly risky and threatens to overload the circuits. Going after the Sunnis and Kurds may fail, dooming Maliki to defeat. Many Sunnis already believe he is a tool of the Iranians. Now they say his sudden anti-Americanism is no proof of Iraqi patriotism, but just shows he is a tool of Tehran. The Iranians want the US out of Iraq, not only in order to undermine US credibility in the region. They interpret Washington's support for the Awakening councils as a tilt towards the Sunnis and an effort to re-balance Iraqi politics from the Shia dominance of the early post-invasion period.

Maliki's tough stance towards the US could doom him personally. The US toppled his predecessor, Ibrahim Jaaferi, and, even though US power in Iraq has declined since then, it may find a way to remove Maliki too. It would not demand that the prime minister go, as it did in 2006, but could undermine his parliamentary majority. The US has alternative candidates, including the ambitious vice-president, Adel Abdel Mahdi, and the Sunni defence minister, Abdul Qader al-Obeidi, who told the New York Times in January that US troops would be needed for another 10 years.

Whatever his motives, Maliki's move has certainly shaken up Iraqi politics and forced the issue of a clear US departure timetable on to the agenda. The Iraqi prime minister has put Bush and McCain on to the back foot, and given help to Obama. Whether Maliki or Bush blinks first remains to be seen.

j.steele@theguardian.com