Arguably this is a "glass half full" post, but none the less I think it is a good thing that Hamas has apparently won the Palestinian election. Why is it good? Because it allows the world, and particularly the Palestinians, to grasp some basic concepts such as "actions have consequences" and "think before you vote".
If (and it is a big if) Hamas is able to take power and not descend into corruption like practically every other Middle Eastern regime then conceivably the Palestinians will be better off under Hamas. Given the hopelessly corrupt and incompetant Fatah government it seems difficult to imagine that Hamas can do worse but I have no great hopes but it is important that the world see whether they can because it is a win-win situation. If they can make it work then the Palestinians will have a functioning goernment for the first time, if they can't then it will be clear that they are no better than Fatah.
Similarly with regard to foreign relations (i.e. Israel). Hence the first thing that should be done is to ensure that Hamas finds itself clearly responsible for governing. This means that they must be clearly instructed to take over the government and must also be forced to make clear statements on their position with respect to the State of Israel, terrorism etc. with the clear explanation that the "wrong" answer means no more funding. I do not expect Hamas to give the right answers to these questions so this will force the liberal west to involve themselves in contortions almost as good as G Galloway's recent Big Brother stunts in a similar spotlight of publicity.
I fully expact Hamas' governing stint to be a total disaster with policy statements reminiscent of Iran under Ahmedinejad and with its ability to handle day to day government within Gaza and the West Bank to be about as competant as Mugabe's governing of Zimbabwe and hence for the two areas to fall further into anarchy. I also fully expect them to then whine excessively about how Zionist Imperialist lackeys have been sabotaging their efforts.
The key will be to then ensure that the next elections occur on time and freely. If they do then I suspect some of the more competant young militia leaders will be elected and then, with luck, the Palestinians will have a government that can both enforce the rule of law internally and negotiate externally. But as I see it the only way to get to that point is to treat every one as grown ups and let them make their own messes.