The only way to make sense of Israel's senseless war in Gaza is through understanding the historical context. Establishing the state of Israel in May 1948 involved a monumental injustice to the Palestinians. British officials bitterly resented American partisanship on behalf of the infant state. On 2 June 1948, Sir John Troutbeck wrote to the foreign secretary, Ernest Bevin, that the Americans were responsible for the creation of a gangster state headed by "an utterly unscrupulous set of leaders". I used to think that this judgment was too harsh but Israel's vicious assault on the people of Gaza, and the Bush administration's complicity in this assault, have reopened the question.

I write as someone who served loyally in the Israeli army in the mid-1960s and who has never questioned the legitimacy of the state of Israel within its pre-1967 borders. What I utterly reject is the Zionist colonial project beyond the Green Line. The Israeli occupation of the West Bank and the Gaza Strip in the aftermath of the June 1967 war had very little to do with security and everything to do with territorial expansionism. The aim was to establish Greater Israel through permanent political, economic and military control over the Palestinian territories. And the result has been one of the most prolonged and brutal military occupations of modern times.

Four decades of Israeli control did incalculable damage to the economy of the Gaza Strip. With a large population of 1948 refugees crammed into a tiny strip of land, with no infrastructure or natural resources, Gaza's prospects were never bright. Gaza, however, is not simply a case of economic under-development but a uniquely cruel case of deliberate de-development. To use the Biblical phrase, Israel turned the people of Gaza into the hewers of wood and the drawers of water, into a source of cheap labour and a captive market for Israeli goods. The development of local industry was actively impeded so as to make it impossible for the Palestinians to end their subordination to Israel and to establish the economic underpinnings essential for real political independence.

Gaza is a classic case of colonial exploitation in the post-colonial era. Jewish settlements in occupied territories are immoral, illegal and an insurmountable obstacle to peace. They are at once the instrument of exploitation and the symbol of the hated occupation. In Gaza, the Jewish settlers numbered only 8,000 in 2005 compared with 1.4 million local residents. Yet the settlers controlled 25% of the territory, 40% of the arable land and the lion's share of the scarce water resources. Cheek by jowl with these foreign intruders, the majority of the local population lived in abject poverty and unimaginable misery. Eighty per cent of them still subsist on less than $2 a day. The living conditions in the strip remain an affront to civilised values, a powerful precipitant to resistance and a fertile breeding ground for political extremism.

In August 2005 a Likud government headed by Ariel Sharon staged a unilateral Israeli pullout from Gaza, withdrawing all 8,000 settlers and destroying the houses and farms they had left behind. Hamas, the Islamic resistance movement, conducted an effective campaign to drive the Israelis out of Gaza. The withdrawal was a humiliation for the Israeli Defence Forces. To the world, Sharon presented the withdrawal from Gaza as a contribution to peace based on a two-state solution. But in the year after, another 12,000 Israelis settled on the West Bank, further reducing the scope for an independent Palestinian state. Land-grabbing and peace-making are simply incompatible. Israel had a choice and it chose land over peace.

The real purpose behind the move was to redraw unilaterally the borders of Greater Israel by incorporating the main settlement blocs on the West Bank to the state of Israel. Withdrawal from Gaza was thus not a prelude to a peace deal with the Palestinian Authority but a prelude to further Zionist expansion on the West Bank. It was a unilateral Israeli move undertaken in what was seen, mistakenly in my view, as an Israeli national interest. Anchored in a fundamental rejection of the Palestinian national identity, the withdrawal from Gaza was part of a long-term effort to deny the Palestinian people any independent political existence on their land.

Israel's settlers were withdrawn but Israeli soldiers continued to control all access to the Gaza Strip by land, sea and air. Gaza was converted overnight into an open-air prison. From this point on, the Israeli air force enjoyed unrestricted freedom to drop bombs, to make sonic booms by flying low and breaking the sound barrier, and to terrorise the hapless inhabitants of this prison.

Israel likes to portray itself as an island of democracy in a sea of authoritarianism. Yet Israel has never in its entire history done anything to promote democracy on the Arab side and has done a great deal to undermine it. Israel has a long history of secret collaboration with reactionary Arab regimes to suppress Palestinian nationalism. Despite all the handicaps, the Palestinian people succeeded in building the only genuine democracy in the Arab world with the possible exception of Lebanon. In January 2006, free and fair elections for the Legislative Council of the Palestinian Authority brought to power a Hamas-led government. Israel, however, refused to recognise the democratically elected government, claiming that Hamas is purely and simply a terrorist organisation.

America and the EU shamelessly joined Israel in ostracising and demonising the Hamas government and in trying to bring it down by withholding tax revenues and foreign aid. A surreal situation thus developed with a significant part of the international community imposing economic sanctions not against the occupier but against the occupied, not against the oppressor but against the oppressed.

As so often in the tragic history of Palestine, the victims were blamed for their own misfortunes. Israel's propaganda machine persistently purveyed the notion that the Palestinians are terrorists, that they reject coexistence with the Jewish state, that their nationalism is little more than antisemitism, that Hamas is just a bunch of religious fanatics and that Islam is incompatible with democracy. But the simple truth is that the Palestinian people are a normal people with normal aspirations. They are no better but they are no worse than any other national group. What they aspire to, above all, is a piece of land to call their own on which to live in freedom and dignity.

Like other radical movements, Hamas began to moderate its political programme following its rise to power. From the ideological rejectionism of its charter, it began to move towards pragmatic accommodation of a two-state solution. In March 2007, Hamas and Fatah formed a national unity government that was ready to negotiate a long-term ceasefire with Israel. Israel, however, refused to negotiate with a government that included Hamas.

It continued to play the old game of divide and rule between rival Palestinian factions. In the late 1980s, Israel had supported the nascent Hamas in order to weaken Fatah, the secular nationalist movement led by Yasser Arafat. Now Israel began to encourage the corrupt and pliant Fatah leaders to overthrow their religious political rivals and recapture power. Aggressive American neoconservatives participated in the sinister plot to instigate a Palestinian civil war. Their meddling was a major factor in the collapse of the national unity government and in driving Hamas to seize power in Gaza in June 2007 to pre-empt a Fatah coup.

The war unleashed by Israel on Gaza on 27 December was the culmination of a series of clashes and confrontations with the Hamas government. In a broader sense, however, it is a war between Israel and the Palestinian people, because the people had elected the party to power. The declared aim of the war is to weaken Hamas and to intensify the pressure until its leaders agree to a new ceasefire on Israel's terms. The undeclared aim is to ensure that the Palestinians in Gaza are seen by the world simply as a humanitarian problem and thus to derail their struggle for independence and statehood.

The timing of the war was determined by political expediency. A general election is scheduled for 10 February and, in the lead-up to the election, all the main contenders are looking for an opportunity to prove their toughness. The army top brass had been champing at the bit to deliver a crushing blow to Hamas in order to remove the stain left on their reputation by the failure of the war against Hezbollah in Lebanon in July 2006. Israel's cynical leaders could also count on apathy and impotence of the pro-western Arab regimes and on blind support from President Bush in the twilight of his term in the White House. Bush readily obliged by putting all the blame for the crisis on Hamas, vetoing proposals at the UN Security Council for an immediate ceasefire and issuing Israel with a free pass to mount a ground invasion of Gaza.

As always, mighty Israel claims to be the victim of Palestinian aggression but the sheer asymmetry of power between the two sides leaves little room for doubt as to who is the real victim. This is indeed a conflict between David and Goliath but the Biblical image has been inverted - a small and defenceless Palestinian David faces a heavily armed, merciless and overbearing Israeli Goliath. The resort to brute military force is accompanied, as always, by the shrill rhetoric of victimhood and a farrago of self-pity overlaid with self-righteousness. In Hebrew this is known as the syndrome of bokhim ve-yorim, "crying and shooting".

To be sure, Hamas is not an entirely innocent party in this conflict. Denied the fruit of its electoral victory and confronted with an unscrupulous adversary, it has resorted to the weapon of the weak - terror. Militants from Hamas and Islamic Jihad kept launching Qassam rocket attacks against Israeli settlements near the border with Gaza until Egypt brokered a six-month ceasefire last June. The damage caused by these primitive rockets is minimal but the psychological impact is immense, prompting the public to demand protection from its government. Under the circumstances, Israel had the right to act in self-defence but its response to the pinpricks of rocket attacks was totally disproportionate. The figures speak for themselves. In the three years after the withdrawal from Gaza, 11 Israelis were killed by rocket fire. On the other hand, in 2005-7 alone, the IDF killed 1,290 Palestinians in Gaza, including 222 children.

Whatever the numbers, killing civilians is wrong. This rule applies to Israel as much as it does to Hamas, but Israel's entire record is one of unbridled and unremitting brutality towards the inhabitants of Gaza. Israel also maintained the blockade of Gaza after the ceasefire came into force which, in the view of the Hamas leaders, amounted to a violation of the agreement. During the ceasefire, Israel prevented any exports from leaving the strip in clear violation of a 2005 accord, leading to a sharp drop in employment opportunities. Officially, 49.1% of the population is unemployed. At the same time, Israel restricted drastically the number of trucks carrying food, fuel, cooking-gas canisters, spare parts for water and sanitation plants, and medical supplies to Gaza. It is difficult to see how starving and freezing the civilians of Gaza could protect the people on the Israeli side of the border. But even if it did, it would still be immoral, a form of collective punishment that is strictly forbidden by international humanitarian law.

The brutality of Israel's soldiers is fully matched by the mendacity of its spokesmen. Eight months before launching the current war on Gaza, Israel established a National Information Directorate. The core messages of this directorate to the media are that Hamas broke the ceasefire agreements; that Israel's objective is the defence of its population; and that Israel's forces are taking the utmost care not to hurt innocent civilians. Israel's spin doctors have been remarkably successful in getting this message across. But, in essence, their propaganda is a pack of lies.

A wide gap separates the reality of Israel's actions from the rhetoric of its spokesmen. It was not Hamas but the IDF that broke the ceasefire. It di d so by a raid into Gaza on 4 November that killed six Hamas men. Israel's objective is not just the defence of its population but the eventual overthrow of the Hamas government in Gaza by turning the people against their rulers. And far from taking care to spare civilians, Israel is guilty of indiscriminate bombing and of a three-year-old blockade that has brought the inhabitants of Gaza, now 1.5 million, to the brink of a humanitarian catastrophe.

The Biblical injunction of an eye for an eye is savage enough. But Israel's insane offensive against Gaza seems to follow the logic of an eye for an eyelash. After eight days of bombing, with a death toll of more than 400 Palestinians and four Israelis, the gung-ho cabinet ordered a land invasion of Gaza the consequences of which are incalculable.

No amount of military escalation can buy Israel immunity from rocket attacks from the military wing of Hamas. Despite all the death and destruction that Israel has inflicted on them, they kept up their resistance and they kept firing their rockets. This is a movement that glorifies victimhood and martyrdom. There is simply no military solution to the conflict between the two communities. The problem with Israel's concept of security is that it denies even the most elementary security to the other community. The only way for Israel to achieve security is not through shooting but through talks with Hamas, which has repeatedly declared its readiness to negotiate a long-term ceasefire with the Jewish state within its pre-1967 borders for 20, 30, or even 50 years. Israel has rejected this offer for the same reason it spurned the Arab League peace plan of 2002, which is still on the table: it involves concessions and compromises.

This brief review of Israel's record over the past four decades makes it difficult to resist the conclusion that it has become a rogue state with "an utterly unscrupulous set of leaders". A rogue state habitually violates international law, possesses weapons of mass destruction and practises terrorism - the use of violence against civilians for political purposes. Israel fulfils all of these three criteria; the cap fits and it must wear it. Israel's real aim is not peaceful coexistence with its Palestinian neighbours but military domination. It keeps compounding the mistakes of the past with new and more disastrous ones. Politicians, like everyone else, are of course free to repeat the lies and mistakes of the past. But it is not mandatory to do so.

• Avi Shlaim is a professor of international relations at the University of Oxford and the author of The Iron Wall: Israel and the Arab World and of Lion of Jordan: King Hussein's Life in War and Peace.