One of Britain's most authoritative judicial figures last night delivered a blistering attack on the invasion of Iraq, describing it as a serious violation of international law, and accusing Britain and the US of acting like a "world vigilante".

Lord Bingham, in his first major speech since retiring as the senior law lord, rejected the then attorney general's defence of the 2003 invasion as fundamentally flawed.

Contradicting head-on Lord Goldsmith's advice that the invasion was lawful, Bingham stated: "It was not plain that Iraq had failed to comply in a manner justifying resort to force and there were no strong factual grounds or hard evidence to show that it had." Adding his weight to the body of international legal opinion opposed to the invasion, Bingham said that to argue, as the British government had done, that Britain and the US could unilaterally decide that Iraq had broken UN resolutions "passes belief".

Governments were bound by international law as much as by their domestic laws, he said. "The current ministerial code," he added "binding on British ministers, requires them as an overarching duty to 'comply with the law, including international law and treaty obligations'."

The Conservatives and Liberal Democrats continue to press for an independent inquiry into the circumstances around the invasion. The government says an inquiry would be harmful while British troops are in Iraq. Ministers say most of the remaining 4,000 will leave by mid-2009.

Addressing the British Institute of International and Comparative Law last night, Bingham said: "If I am right that the invasion of Iraq by the US, the UK, and some other states was unauthorised by the security council there was, of course, a serious violation of international law and the rule of law.

"For the effect of acting unilaterally was to undermine the foundation on which the post-1945 consensus had been constructed: the prohibition of force (save in self-defence, or perhaps, to avert an impending humanitarian catastrophe) unless formally authorised by the nations of the world empowered to make collective decisions in the security council ..."

The moment a state treated the rules of international law as binding on others but not on itself, the compact on which the law rested was broken, Bingham argued. Quoting a comment made by a leading academic lawyer, he added: "It is, as has been said, 'the difference between the role of world policeman and world vigilante'."

Bingham said he had very recently provided an advance copy of his speech to Goldsmith and to Jack Straw, foreign secretary at the time of the invasion of Iraq. He told his audience he should make it plain they challenged his conclusions.

Both men emphasised that point last night by intervening to defend their views as consistent with those held at the time of the invasion. Goldsmith said in a statement: "I stand by my advice of March 2003 that it was legal for Britain to take military action in Iraq. I would not have given that advice if it were not genuinely my view. Lord Bingham is entitled to his own legal perspective five years after the event." Goldsmith defended what is known as the "revival argument" - namely that Saddam Hussein had failed to comply with previous UN resolutions which could now take effect. Goldsmith added that Tony Blair had told him it was his "unequivocal view" that Iraq was in breach of its UN obligations to give up weapons of mass destruction.

Straw said last night that he shared Goldsmith's view. He continued: "However controversial the view that military action was justified in international law it was our attorney general's view that it was lawful and that view was widely shared across the world."

Bingham also criticised the post-invasion record of Britain as "an occupying power in Iraq". It is "sullied by a number of incidents, most notably the shameful beating to death of Mr Baha Mousa [a hotel receptionist] in Basra [in 2003]", he said.

Such breaches of the law, however, were not the result of deliberate government policy and the rights of victims had been recognised, Bingham observed.

He contrasted that with the "unilateral decisions of the US government" on issues such as the detention conditions in Guantánamo Bay, Cuba.

After referring to mistreatment of Iraqi detainees in Abu Ghraib, Bingham added: "Particularly disturbing to proponents of the rule of law is the cynical lack of concern for international legality among some top officials in the Bush administration."