Israel's decision to take military action against Hamas rocket attacks targeting its civilian population has been long in coming. I vividly recall a visit my wife and I took to the Israeli city of Sderot on March 20 of this year. Over the past four years, Palestinian terrorists – in particular, Hamas and Islamic Jihad – have fired more than 2,000 rockets at this civilian area, which is home to mostly poor and working-class people.

The rockets are designed exclusively to maximize civilian deaths, and some have barely missed schoolyards, kindergartens, hospitals, and school buses. But others hit their targets, killing more than a dozen civilians since 2001, including in February 2008 a father of four who had been studying at the local university. These anticivilian rockets have also injured and traumatized countless children.

The residents of Sderot were demanding that their nation take action to protect them. But Israel's postoccupation military options were limited, since Hamas deliberately fires its deadly rockets from densely populated urban areas, and the Israeli army has a strict policy of trying to avoid civilian casualties.

The firing of rockets at civilians from densely populated civilian areas is the newest tactic in the war between terrorists who love death and democracies that love life. The terrorists have learned how to exploit the morality of democracies against those who do not want to kill civilians, even enemy civilians.

The attacks on Israeli citizens have little to do with what Israel does or does not do. They have everything to do with an ideology that despises – and openly seeks to destroy – the Jewish state. Consider that rocket attacks increased substantially after Israel disengaged from Gaza in 2005, and they accelerated further after Hamas seized control last year.

In the past months, a shaky cease-fire, organized by Egypt, was in effect. Hamas agreed to stop the rockets and Israel agreed to stop taking military action against Hamas terrorists in the Gaza Strip. The cease-fire itself was morally dubious and legally asymmetrical.

Israel, in effect, was saying to Hamas: If you stop engaging in the war crime of targeting our innocent civilians, we will stop engaging in the entirely lawful military acts of targeting your terrorists. Under the cease-fire, Israel reserved the right to engage in self-defense actions such as attacking terrorists who were in the course of firing rockets at its civilians.

Just before the hostilities began, Israel reopened a checkpoint to allow humanitarian aid to reenter Gaza. It had closed the point of entry after it had been targeted by Gazan rockets. Israel's prime minister, Ehud Olmert, also issued a stern, final warning to Hamas that unless it stopped the rockets, there would be a full-scale military response. The Hamas rockets continued and Israel kept its word, implementing a carefully prepared targeted air attack against Hamas targets.

On Sunday, I spoke to the air force general, now retired, who worked on the planning of the attack. He told me of the intelligence and planning that had gone into preparing for the contingency that the military option might become necessary. The Israeli air force had pinpointed with precision the exact locations of Hamas structures in an effort to minimize civilian casualties.

Even Hamas sources have acknowledged that the vast majority of those killed have been Hamas terrorists, though some civilian casualties are inevitable when, as BBC's Rushdi Abou Alouf – who is certainly not pro-Israel – reported, "The Hamas security compounds are in the middle of the city." Indeed, his home balcony was just 20 meters away from a compound he saw bombed.

There have been three types of international response to the Israeli military actions against the Hamas rockets. Not surprisingly, Iran, Hamas, and other knee-jerk Israeli-bashers have argued that the Hamas rocket attacks against Israeli civilians are entirely legitimate and that the Israeli counterattacks are war crimes.

Equally unsurprising is the response of the United Nations, the European Union, Russia, and others who, at least when it comes to Israel, see a moral and legal equivalence between terrorists who target civilians and a democracy that responds by targeting the terrorists.

And finally, there is the United States and a few other nations that place the blame squarely on Hamas for its unlawful and immoral policy of using its own civilians as human shields, behind whom they fire rockets at Israeli civilians.

The most dangerous of the three responses is not the Iranian-Hamas absurdity, which is largely ignored by thinking and moral people, but the United Nations and European Union response, which equates the willful murder of civilians with legitimate self-defense pursuant to Article 51 of the United Nations Charter.

This false moral equivalence only encourages terrorists to persist in their unlawful actions against civilians. The US has it exactly right by placing the blame on Hamas, while urging Israel to do everything possible to minimize civilian casualties.

• Alan M. Dershowitz is the Felix Frankfurter professor of law at Harvard Law School. His latest book is "The Case Against Israel's Enemies: Exposing Jimmy Carter and Others Who Stand in the Way of Peace."