Tony Blair will be quizzed over a devastating official memo warning him that war on Iraq would be illegal eight months before he sent troops into Baghdad, it was claimed last night.

The Chilcot inquiry into the Iraq war will consider a letter from Lord Goldsmith, then Mr Blair's top law officer, advising him that deposing Saddam would be in breach of international law, according to a report in The Mail on Sunday.

But Mr Blair refused to accept Lord Goldsmith's advice and instead issued instructions for his long-term friend to be "gagged" and barred from cabinet meetings, the newspaper claimed. Lord Goldsmith apparently lost three stone, and complained he was "more or less pinned to the wall" in a No 10 showdown with two of Mr Blair's most loyal aides, Lord Falconer and Baroness Morgan. Mr Blair also allegedly failed to inform the Cabinet of the warning, fearing an "anti-war revolt".

Download the new Independent Premium app Sharing the full story, not just the headlines

Lord Goldsmith allegedly threatened to resign over the issue, but was "bullied" into backing down. He eventually issued carefully drafted qualified backing for the invasion.

But according to The Mail on Sunday, his advice was radically different in July 2002, when ministers were allegedly told the US and UK planned "regime change" in Iraq. Then Lord Goldsmith reportedly wrote a letter to Mr Blair on 29 July, flagging up the legal difficulties of the plan of campaign he had apparently thrashed out with President George Bush. The letter pointed out: (1) Although UN rules permitted "military intervention on the basis of self-defence, they did not apply in this case as Britain was not under threat from Iraq; (2) While the UN allowed "humanitarian intervention" in certain cases, that too was not relevant to Iraq; (3) It would be very hard to rely on earlier UN resolutions in the Nineties approving the use of force against Saddam.

Lord Goldsmith ended by saying "the situation might change" – although, in legal terms, it never did. The advice, and the decision to commit it to an official record, reportedly caused great friction between the two men, as it was feared publication of the details could undermine the case for war and damage Mr Blair's credibility.

The revelations follow testimony from a series of by figures at the Chilcot inquiry who have questioned Mr Blair's judgement and honesty, and the legality of the war. The Independent on Sunday understands, after only four days of testimony, the former prime minister was already furious that his reputation could be "shredded" by senior civil servants taking revenge on him during the inquiry into the Iraq conflict, it emerged last night.

Mr Blair has been appalled by the high-profile evidence given by mandarins who have appeared before the Chilcot inquiry since the first round of public hearings began last Tuesday, close friends have revealed. His image has taken a battering over the past six days, as a series of current and former public servants have given evidence that conflicts with the Government's account of the intelligence assessment of Iraq's weapons capability before the invasion in March 2003.

Among the devastating details presented to the inquiry was the revelation that British spies reported 10 days before the invasion that Iraq had "disassembled" what chemical weapons it had – but Mr Blair went ahead and sent troops into battle. Britain's former ambassador to Washington, Sir Christopher Meyer, claimed Mr Blair and Mr Bush had signed a secret deal "in blood" to remove Saddam almost a year before the invasion. He said the agreement in effect left officials scrabbling to find "a smoking gun" to justify going to war.

Mr Blair's friends claimed last night that he has found some of the evidence given so far "distasteful", and potentially damaging to his reputation. "It is clear that the headlines so far have not been helpful to him," a former minister said. "But more troubling is the sense that some of the people involved are so keen to stick the knife in. It is quite distasteful."

Inside Politics newsletter The latest news on Brexit, politics and beyond direct to your inbox Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive updates on politics every morning by email Update newsletter preferences

Another Blair ally said the former leader had made clear his concern that "his reputation could be shredded by the Chilcot process". "He is furious that mandarins are seeking revenge and discovering their principles after the event," one friend added.

Sir Christopher Meyer has attracted much criticism from Blairites following a flamboyant appearance during which he claimed Mr Blair's view on "regime change" in Iraq hardened after a private meeting with Mr Bush in 2002. He also compared Mr Blair unflatteringly to Margaret Thatcher. The former diplomat told the inquiry on Thursday: "She would have insisted on a clear, coherent political/diplomatic strategy and I think she would have demanded the greatest clarity about what the heck happened if and when we removed Saddam."

Sir Jeremy Greenstock, who worked beside Mr Blair in his attempts to gain UN blessing for the invasion, said the war was of "questionable legitimacy" even though it is unlikely to be proved illegal. The former UK ambassador to the UN said the invasion did not have the backing of most UN members or the British public.

Mr Blair assured MPs in the run-up to the invasion that "extensive, detailed and authoritative" intelligence showed "beyond doubt" that Saddam had continued to produce chemical and biological weapons; tried to develop nuclear weapons; and that he had already produced chemical weapons – and used them on his own people. His government produced two dossiers on Saddam's weapons capability, to back up the case for war.

It has since been shown that much of the intelligence received by the Government in the run-up to the war was confused and inaccurate. Sir William Ehrman, the Foreign Office director general for defence and intelligence at the time, told the inquiry that a report suggested Saddam may not have been able to use chemical weapons. A separate report suggested Iraq might also "lack" warheads capable of spreading chemical agents.

Tim Dowse, the director of counter-proliferation at the Foreign Office between 2001-2003, said most evidence suggested Iraq's chemical and biological programme was largely "destroyed" in 1991. He said intelligence in late 2002 suggested Iraq was rebuilding its capability, although its actual position was unclear after weapons inspectors were expelled in 1998.

And now it appears the inquiry could become more uncomfortable for Mr Blair. It is understood the Chilcot panel has already been given Lord Goldsmith's letter. The two are both likely to be interrogated about it when they give evidence in the new year.

Critical evidence from key figures to Chilcot inquiry

Sir Peter Ricketts "We quite clearly distanced ourselves from talk of regime change... that was not something we thought there would be any legal base for."

Sir William Patey "We were aware of those drumbeats from Washington [about regime change]. Our policy was to stay away from that end of the spectrum."

Sir Michael Wood "[Establishing no-fly zones over Iraq] was very controversial ... The US government was very careful to avoid taking any real position on the law."

Sir William Ehrman "We did, on 10 March, get a report that chemical weapons might have remained disassembled and Saddam hadn't yet ordered their assembly."

Sir Christopher Meyer "Suddenly, because of the unforgiving nature of the military timetable, we found ourselves scrabbling for the smoking gun."

Sir Jeremy Greenstock "I regarded our participation in the military action against Iraq in March 2003 as legal, but of questionable legitimacy."