Jack Straw has insisted that regime change in Iraq was "never" UK policy even though some within government may have wanted Saddam Hussein removed.
The former foreign secretary told the Iraq inquiry that such a policy would have been "palpably illegal" and he had made this clear to Tony Blair.
If Saddam agreed to co-operate and disarm, he would have "stayed in post".
Mr Straw is giving evidence for the third time in what is scheduled to be the last public hearing.
The inquiry has been seeking to establish when the UK committed itself to military action and why its efforts to secure further UN authorisation for the move in early 2003 failed.
Mr Straw said toppling Saddam Hussein was "never an objective" as the UK considered how to deal with Iraq and escalating US demands for action during 2002.
He said he "categorically" told Mr Blair that regime change, as an end in itself, was "not a good idea" from a practical point of view and was clearly unlawful.
"You could have the wish and desire to see regime change and within clear limits wanted to encourage that. But it could not be and was not an objective of British government policy," he said.
Momentum towards dealing with Iraq began in January 2002, Mr Straw said, when President George Bush included Iraq in a list of countries that he described as an "axis of evil".
"I could sense the game change that his statement led to," Mr Straw said, adding that he told Mr Blair of his reservations about the comments.
Although he had a "difference of emphasis" with Mr Blair about how to proceed against Iraq, he said he was "on the same page" as the prime minister in trying to get Iraq to comply through the UN.
If that had happened, Mr Straw said he believed the invasion would not have happened.
"There would have been no possibility of the UK being involved in military action, at all, and I do not think that even if President Bush had been ill-advised enough to want to go to war, he would have done so.
"What would have been the cause of war in those circumstances?"