Mr Annan, who last week branded the US-led war in Iraq "illegal", told the UN general assembly that international law remained the cornerstone of global stability in a speech laced with many veiled - and at least one explicit - criticism of the US.
He said, just minutes before US president George Bush spoke, that the law "including security council resolutions ... offers the best foundation for resolving prolonged conflicts - in the Middle East, in Iraq, and around the world. Those who seek to bestow legitimacy must themselves embody it, and those who invoke international law must themselves submit to it."
On the opening day of a two-week session attended by 64 presidents, 25 prime ministers and 86 foreign ministers, Mr Annan listed "only a few flagrant and topical examples" of human rights violations and indifference to international and national laws.
He denounced terrorism in Iraq, violence in the Darfur province of Sudan, killings by both Palestinian suicide bombers and the Israeli state, the recent fatal hostage crisis in Beslan, Russia, and the actions of the Lord's Resistance Army in northern Uganda.
He also mentioned the human rights abuses in Iraq committed in Abu Ghraib prison by American soldiers. "In Iraq we see civilians massacred in cold blood, while relief workers, journalists and other noncombatants are taken hostage and put to death in the most barbarous fashion," he said. "We have seen Iraqi prisoners disgracefully abused."
Mr Annan argued that there was a knock-on effect when law was flouted. "No cause, no grievance, however legitimate in itself, can begin to justify such acts," he said. "They put all of us to shame. Their prevalence reflects our collective failure to uphold the law and to instil respect for it in our fel low men and women. We all have a duty to do whatever we can to restore that respect."
To do that, Annan said, "we must start from the principle that no one is above the law, and no one should be denied its protection.
"Every nation that proclaims the rule of law at home must respect it abroad. And every nation that insists on it abroad must enforce it at home.
"Today the rule of law is at risk around the world. Again and again we see laws shamelessly disregarded."
He said some nations had used the war against terrorism as an excuse "to encroach unnecessarily on civil liberties".