The attorney general Lord Goldsmith completely changed his view about the legality of the Iraq war over a two-month period, the Chilcot inquiry heard today.

Elizabeth Wilmshurst, former deputy legal adviser at the Foreign Office, revealed that Goldsmith initially sent a "provisional" view to Tony Blair in January 2003 that a second UN resolution would be required for the invasion to be legal.

But by 7 March the position of Goldsmith, who gives evidence to the inquiry tomorrow, was that there was a reasonable case for arguing the war would be legal without a second resolution. Then by 17 March, just days before the war, he said there was no need for a second resolution.

In a dramatic day at the inquiry, which Blair will face on Friday, Jack Straw's chief legal adviser at the time of the Iraq invasion also today told the inquiry that the then foreign secretary overruled his advice against military action. The revelation by Sir Michael Wood, the top Foreign Office lawyer at the time, challenges the evidence Straw, now justice secretary, gave to the inquiry last week in which he insisted that he had "very reluctantly" supported the conflict.

Wilmshurst, who was the only civil servant to quit over the Iraq war, is the first witness to reveal that Goldsmith's view as late as January 2003 was that a second UN resolution may be required for the invasion to be legal. She said she thought it was unprecedented for a prime minister to be consulted in this way.

She told the inquiry panel, which is looking into the legality of the war, that she was shown this advice unofficially at the time. "His draft advice, his provisional view, was that a second resolution was needed, as I recall," she said.

The lawyer, who told her superiors that an invasion without UN sanction would be a "crime of aggression" when she quit a few days before the invasion, said today that the way ministers handled the legal arguments over the war was "lamentable".

Declassified documents released by the inquiry also show that Wood warned ministers three months before the invasion that it was not certain if military action would be legal.

David Brummell, then a senior aide to the attorney general, also revealed that Lord Goldsmith warned both No 10 and Straw in November 2002 he was "pessimistic" that UN security council resolution 1441 could be used to justify military action without a second resolution.

Today, in a collection of evidence that intensifies the pressure on Blair, the panel also released a memo written by Wood that refers to a Foreign Office cable detailing a meeting between Straw and Colin Powell, the then US secretary of state, in which the foreign secretary reassured his American counterpart a year before the invasion that he was "entirely comfortable" making the case for war.

The meeting took place before Blair visited President Bush in Crawford, Texas, where the then prime minister was accused of "signing in blood" an agreement to join the US in an invasion.

This morning Wood told the inquiry panel, which is looking at the legality of the war, that he had rejected the government's argument that 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 Straw 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," said Wood.

"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."

He 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, 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.

Wood said there had been a reluctance by ministers to seek the attorney general's 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.