There is an obvious connection between what is happening in Iraq at the moment and the Abbott Government's announcement last week of new measures to fight terrorism at home.

A significant number of young Australian nationals have traveled to fight in conflicts in Syria and Iraq. Some are fighting with the Islamic State (formerly ISIL/ISIS), whose sweep through northern Iraq has now prompted President Obama to launch limited air strikes against the group. The fear is that these Australians fighting with the Islamic State or other radical groups in Syria and Iraq may return home, having picked up military skills and jihadist connections that might one day be used in terror attacks in Australia.

But there is another connection between what is happening in Iraq and Australia that deserves attention.

The main reason the Islamic State has made such gains in Iraq is that Prime Minister Nouri al-Maliki has not ruled for all Iraqis. In particular, by disenfranchising the Sunni minority, he created a fertile field for the Islamic State to plow. There is no way the group's relatively few fighters could have made the gains they did without the implicit and in some cases explicit backing of Sunni communities in Iraq's north.

That backing came not because these communities loved what the Islamic State was offering. Quite the contrary. In fact, the main threat to the Islamic State's gains is not the Iraqi Army (with or without US air cover), but the likelihood that ordinary Sunnis will chafe under the Islamic State's harsh rule. Indeed, it is a significant measure of Sunni discontent with Baghdad that Sunnis are prepared, for the moment at least, to do a deal with this particular devil.

Which brings us to Australia. I am not remotely suggesting that Australia faces an insurgency along the lines of what we have seen in Iraq or that Australian Muslims are as disenfranchised as Iraq's Sunnis. But there is a lesson for Australia all the same. And that is, to defeat terrorism you need the support of communities from which the terrorists might come or within which they might seek shelter and support. To get that support, these communities need to feel included, not marginalised.

This should be a matter of principle. Political leaders often riff on the line that terrorists target us because they hate what we represent: tolerance, openness, democracy. But that means we need to do more than just pay lip service to these principles.

It is also a practical matter. For those agencies charged with leading the fight against terrorism, Muslim communities in Australia will be the best source of information and knowledge on those from within their midst who are fighting in Syria and Iraq or who have succumbed to radical and violent ideas.

And should that terrible day come when an act of terrorism is perpetrated in the name of radical Islam in Australia, then strong, open and confident ties with Muslim communities will be essential to ensuring that any such attack does not lead to further outbreaks of violence and retribution of the type that will tear deeply into the fabric of our society – precisely what the extremists want.

The risk of a terrorist attack in Australia is grave. More Australians have chosen to fight in Syria and Iraq than chose to fight in Afghanistan in the days when al Qaeda was being formed there.

More generally, the turmoil in the Middle East is seeing the creation of a new generation of combat-experienced jihadists, including some from our own region. Indonesia and Malaysians are also finding their way to Middle Eastern conflict zones.

However, this is not just a case of radical Islam running amok. It flows from the repressive measures being introduced by revived authoritarian structures after the failure of the Arab uprisings. Iraq is the most obvious example. Egypt deserves attention too, especially given the willingness of public figures like Tony Blair to anoint the country's elected autocrat, Abdel Fattah el-Sisi, a moderate. Egypt's history shows us that the kind of immoderate policies being pursued by Sisi will produce many more radicals than it will ever eliminate.

To combat the next-generation terrorist threat in Australia we need a range of tools, including some of those announced by the Government last week. But we will also need Muslim communities that are not on the defensive because they fear the exposure of one bad egg will foul the reputation of their whole community. Defensive communities won't cooperate with police and intelligence agencies. In fact, fearful and defensive communities will provide exactly the kind of environment that extremists like the Islamic State in Iraq love.

To avoid this outcome requires good leadership from Muslim communities but also from federal and state governments. In particular, those politicians and officials leading the fight against terrorism need to consult, listen and explain widely with Muslim communities. The poor reaction of some Muslim community leaders to the measures announced last week is a political failure that needs to be avoided.

This dialogue with Muslim communities won't always be easy and there is room for greater frankness. But frank discussion needs to be productive rather than accusatory. That responsibility extends to the commentariat and the media. References to '100 year wars' are as unhelpful as they are unfounded.

The good news is that we probably have time. I genuinely believe that conditions in the Middle East today are worse in terms of the production of jihadist ideas and activists than anything we saw in the lead-up to 9/11. But it took time for the forces and conditions that created al Qaeda to have their most deadly effect, and we are probably still in the early years of the evolution of this new threat.

Prime Minister Maliki could have averted the arrival of the Islamic State had he acted in a more inclusive fashion towards Iraq's Sunni community. The situation is very different in Australia, but let's learn the lesson about the importance of communities and inclusiveness.

Photo by Flickr user Jane Dalton.