It is a decisive moment in the Middle East. Hamas, victor in the Palestinian elections, may turn out to be Islamic variants of the African National Congress or Sinn Fein, the terrorists who negotiated the only and obvious peace settlement. Or this victory may point to a new era of violence, the despair of the Palestinians legitimising a new wave of terror.Islamic fundamentalism, the ideology of terrorist suicide bombing and the passionate sense of Palestinian injustice is a lethal combination and Hamas is its most obvious expression. To suppose that Hamas can drop its commitment to liberating all of Palestine and resisting Zionism's claims to the last is to suppose the impossible. Now that its stance has been validated by voters, perhaps nothing can be expected except violence and political impasse.My hunch is that we can expect better and that Hamas will try to move away from terrorism. For while it may have earned its place in Palestinian regard through its uncompromising role in the intifidas, it has to do something with the political capital it has won. The decision last summer to participate in elections for a legislative council that was created by the Oslo accords it once fiercely opposed was itself a straw in the wind. Hamas always was as much a political as a religious organisation and its political dimension was there for all to see. Now it has won, it is locked in a political, rather than terrorist, dynamic.Last Friday, Hamas crossed a line when it became Palestine's majority party. Suddenly, it is no longer just Hamas leaders in private who can decide that terrorism is justified; they have to justify it in their parliament and before the wider bar of Palestinian public opinion. The occupation may go on, but the political position of the principal resistance movement has been transformed.Reflect on what terrorism constitutes. Brazilian terrorist Carlos Marighella defined it simply as 'the use of a bomb attack' to stir revolutionary class war. But that's useless. Against whom, exactly? How is any bombing decision arrived at and by whom? If governments carry out bomb attacks, they follow the due process of international law and call it war. Any definition of terrorism surely has to tease what distinguishes it from warfare.The starting point is that terrorists necessarily place themselves outside any substantive legal or democratic process; they alone decide that the terrorist act is justifiable and what the terrorist act will be. Terrorism is not war because no process of public justification or formal legitimacy stands behind it. Nor is it political violence, because the targets it chooses involve the collateral death and maiming of innocent non-combatants.An assassination or bombing of a military target is political violence rather than terror; it has rationality and targeted political purpose. Suicide bombing of a Tel Aviv restaurant does not. It is these qualities - the absence of any substantive legal process, randomness of target and collateral death of innocents - that define an act as terrorist.Justifying terrorism as a general principle is impossible. There are acts of terrorism which have had desirable consequences, like the end of apartheid in South Africa. But that is no more than our acceptance of realpolitik, reflecting the side we're on. Palestinian resistance to cruel occupation and the confiscation of their land is understandable, but that does not mean it can shelter under a general moral principle justifying terrorism. The only principle available to justify terrorism is that the consequences of its actions justify the violent means. But if the terrorist has not subjected his or her intentions to any kind of scrutiny, participation or vote by the people for whom he or she is acting, then there is no escaping that the decision belongs in the same category as murder. This is even true if the act of terrorism is to try and right a great wrong, which is what Hamas would claim.This is why Hamas's election victory is so significant. The movement cannot dodge the fact that, as the new majority party, its morality is no longer its own. It cannot plan a suicide bombing without opening up what it proposes to democratic scrutiny, legal process and wider Palestinian public opinion - or else expose itself to the charge of fundamental hypocrisy. The Palestinians may agree that they should resist Israel with violence, but this will now become an act of war rather than a clandestine act of terrorism. And Hamas does not want war.Already this reality is forcing extraordinary change. Two senior Hamas leaders have indicated that their charter, which calls for Israel to retreat to pre-1948 borders, could be amended. It has accepted that it cannot impose sharia law. Furthermore, Palestine possesses the embryonic institutions of a genuine democracy. It has three newspapers with some of the freest commentary in the Arab world. It has a fiercely independent judicial council committed to developing an independent judiciary and rule of law. It has a two-party political system and free elections. Hamas has to operate within these constraints, knowing that Fatah will want to win power back. It has to deliver solid administration, abandon terrorism, maintain the truce and try to achieve a long-term settlement. But the encouraging political reality is that it does so, for now, with all the legitimacy that its militancy has earned it inside Palestine.The worst mistake that the international community could commit is to refuse all dealings with Hamas. This is a moment when the West must commit even more aggressively to support and strengthen Palestine's fragile democratic and welfare infrastructure. It is far too early to talk of progress on a peace settlement, but Hamas could eventually prove to be as promising a partner for peace as Fatah and Yasser Arafat were once considered to be.The paradox is that Hamas would never have had its chance without the American conviction that the route through the Middle Eastern quagmire was the progressive introduction of democracy.But it's not just voting that will count in Palestine; it is, by Arab standards, the free press, the independent courts, trade unions and enfranchised electorate.Hamas now has to justify its actions before this demanding audience and terrorism will not stand the test. But the legitimacy that its courage has earned will allow it options on political strategy that Fatah could never possess. The West's job is to make sure this happens and that Israel is not allowed to pass up the opportunity.