In an interview with BBC on Wednesday, Annan also expressed fears that holding credible elections in Iraq might not be possible as planned in January 2005, in view of the escalating violence.
"I am one of those who believe that there should have been a second resolution from the UN Security Council to green-light the US-led invasion that toppled Saddam Hussein's regime," Annan said.
"I have indicated that it was not in conformity with the UN charter from our point of view, and from the charter point of view it was illegal," he said.
Annan stressed it was for the Security Council to act on UN resolutions to compel Saddam to abandon the pursuit of weapons of mass destruction.
"I have indicated that it was not in conformity with the UN charter from our point of view, and from the charter point of view it was illegal"
UN secretary general
"It was up to the Security Council to approve or determine what those consequences should be," he said.
He added that the US decision to go ahead and invade Iraq, with British forces at its side, "was not in conformity with the Security Council, with the UN charter".
Asked if he meant that the decision to invade was illegal, Annan replied: "Yes, if you wish."
The secretary general also had a grim forecast for Iraq, saying the current level of violence and unrest made credible elections early next year look highly unlikely.
"I think there have been lessons for the US and lessons for the UN and other member states," he said.
"I think that, in the end, everybody's concluded that it is best to work together with our allies and through the UN to deal with some of these issues," Annan said.
"I hope we do not see another Iraq-type operation for a long time."
Meanwhile, Britain, Australia and a former US official, insisted on Thursday that their countries' military action in Iraq was legal.
"The legal advice that we had, and I tabled it at the time, was that the action was entirely valid in international law terms," Australian Prime Minister John Howard told Australian radio.
Howard's view was echoed by Prime Minister Tony Blair's office, which said the British government's top lawyer - Attorney-General Lord Goldsmith - had reached the same conclusion before the invasion was launched in March last year.
John Howard: The action was
British Trade Secretary Patricia Hewitt said she respected Annan, but disagreed with him. "We spelt out at the time our reasons for believing the conflict in Iraq was indeed lawful and why we believed it was necessary," she said.
There was no official response from Washington, but Randy Scheunemann, a former adviser to US Defense Secretary Donald Rumsfeld, said Annan had no right to question the legal judgment of UN member states.
"To do this 51 days before an American election reeks of political interference," he told the BBC.
Poland, another staunch backer of US-led military action in Iraq, insisted the invasion was legal, listing UN resolutions relating to Iraq.
"It must be said that the decision which the international
community took on Iraq had a legal basis," the Polish Foreign Ministry said in a statement.