Jack Straw brushed aside warnings that the invasion of Iraq had no basis in international law, the inquiry into the conflict has been told.
Sir Michael Wood, who was senior legal adviser at the Foreign Office, said he had considered resigning on the eve of the invasion in March 2003 in protest at the decision to join the US-led attack.
He described how he was sidelined after he made clear his objections to military action.
His evidence intensifies the pressure on Tony Blair, who is due to give evidence to the Iraq Inquiry on Friday.
Sir Michael rejected the Government's argument that United Nations Security Council resolution 1441 - passed in November 2002 - requiring Saddam Hussein to disarm was a sufficient basis for military action.
"I considered that the use of force against Iraq in March 2003 was contrary to international law," he said.
"In my opinion, that use of force had not been authorised by the Security Council, and had no other basis in international law."
However, when he presented his view to Mr Straw - who was then foreign secretary - in January 2003, he said it was dismissed out of hand.
"He took the view that I was being very dogmatic and that international law was pretty vague and that he wasn't used to people taking such a firm position," Sir Michael said.
"When he had been at the Home Office, he had often been advised things were unlawful but he had gone ahead anyway and won in the courts."
Sir Michael said this was "probably the first and only occasion" that a minister rejected his legal advice in this way.
"Obviously there are some areas of international law that can be quite uncertain. This however turned exclusively on the interpretation of a specific text and it is one on which I think that international law was pretty clear," he said.
"Because there is no court, the legal adviser and those taking decisions based on the legal advice have to be more scrupulous in adhering to the law."
In a newly declassified letter to the Attorney General Lord Goldsmith released by the inquiry, Mr Straw complained at the attitude taken by government lawyers.
"I have been very forcefully struck by the paradox in the culture of government lawyers, which is the less certain the law is, the more certain in their views they become," he said.
Sir Michael said that ultimately it had been a matter for the attorney to advise on whether military action would be legal, however there had been a reluctance by ministers to seek his views until very late in the day.
"They really needed advice, even if they didn't want it at that stage, in order to develop their policy in the weeks leading up to the failure to get a second resolution," he said.
"My impression is that there was a reluctance in some quarters to seek the attorney's advice too early."
Sir Michael also disclosed how in October 2002 - the month before 1441 was passed - he received a request from Mr Straw's office asking for an "urgent note" on the consequences of acting "without international legal authority".
"This was a rather curious request and I am still not entirely sure what the purpose was," he said.
"I think it was to send off to No 10 and it did go to No 10 who said ‘Why has this been put in writing?' is my recollection," he said.
Sir Michael said that when his deputy, Elizabeth Wilmshurst - who shared his views - resigned on March 18 2003, he had considered following suit.
"I may have briefly considered the matter - I certainly did when Elizabeth resigned but my conclusion was that I should carry on," he said.
"It would certainly have been more disruptive for the legal advisers in the Foreign Office if there had been a host of resignations."
He said he had been kept "on the sidelines" when Government lawyers drafted the statement on the legal case for war which Lord Goldsmith presented as a Parliamentary answer on March 17 2003.
"I think I was more or less on the sidelines because my views were known," he said.
"By that stage, as I saw it, we were in the advocacy mode as opposed to the advisory decision-making mode. This was a matter of presentation, how this is to be presented to the public."