Whales and whaling evoke strong emotions.

To Hermann Melville's Captain Ahab, "all evil were visibly personified in Moby-Dick", and so he "piled upon the whale's white hump … all the general rage and hate felt by his whole race from Adam down".

Since Ahab, perceptions have changed: the whalers, not the whales, now seem to personify evil in their hunt for minke, fin and humpbacks; and general rage is piled upon them. In 1982, against the background of campaigns to "save the whales", countries in the International Whaling Commission (IWC) agreed on a moratorium on commercial whaling, against the views of Japan, Canada, Norway and others.

Outvoted, these countries responded in different ways. While Canada withdrew from the convention and Norway objected to the moratorium, Japan accepted the ban, not least under US pressure. Intended to be temporary in nature, the moratorium has proved surprisingly long-lasting.

In the past decade, it has come under pressure, though. New states have joined the IWC, many of whose meetings were paralysed by ideological confrontation between the increasingly stubborn pro- and anti-whaling lobbies. But this week, the anti-whaling lobby received a major boost. The International Court of Justice (ICJ), the world's principal judicial organ, declared Japan's hunt for whales in Antarctic waters to be in violation of international law. It did so in a case brought by Australia, in a verdict hailed as enormous and historic by environmentalists.

The verdict was not about the legality of whaling as such. As with many other court decisions, it turned on a technical point, namely whether Japan could hunt whales for scientific purposes. Under the terms of the International Convention for the Regulation of Whaling, scientific whaling remains permitted. For 25 years Japan has made use of that option, arguing that supervised whaling helped further understanding of the Antarctic ecosystem and the management of whale stocks. The ICJ rejected that defence. It did not go so far as to say (as Australia had done) that Japan was engaged in commercial whaling in disguise. Whaling could in principle serve a legitimate scientific purpose.

However, in the court's view, Japan's whaling programme did not meet that aim. After years of continued whaling, the scientific results were very limited and Japan had made no serious attempt to cooperate with other scientific organisations. So Japan's programme was not driven by scientific purposes, and thus could not be justified under the terms of the Whaling Convention. It had to be stopped, and Japan had to revoke existing permits for scientific hunting.

While the reasoning was technical, the ICJ's main message is clear. The court was willing to read the International Convention for the Regulation of Whaling very much as an environmental treaty. When that convention was agreed in 1946, it was meant to regulate whaling, not to ban it (hence its title). But times have changed and the court was not going to stand in the way.

Interestingly, its decision bolsters the moratorium at a time when it has come under increasing pressure, with many states and scientists arguing for a compromise permitting commercial whaling within strict limits.

Predictably, Japan has expressed its disappointment at the decision. It is bound by it, but has some leeway in tailoring its response: given that the court has not ruled out scientific whaling as such, Japan could try to revise its programme and make it properly scientific, which would likely require the catch of minke whales to be reduced considerably. It could also choose the "exit option" and follow Norway and Canada by leaving the Whaling Convention. But this would come at a political cost. Either way, the judgment vindicates the Australian decision to take the cause of whales to court: this was a risky gamble (and could have backfired, had the ICJ upheld Japan's view) but, at least in the interim, it has paid off.