Tony Blair today insisted there had been extensive preparations for the aftermath of the Iraq war.
The former prime minister said the British Government was "focused" on how to deal with issues caused by the conflict.
But he accepted there had been a failure to predict the role played by al Qaida and Iran in fomenting the insurgency which broke out.
"The real problem is that our focus was on the issues that in the end were not the issues that caused us the difficulty," he said.
"People didn't think that al Qaida and Iran would play the role that they did. It was really the external elements of al Qaida and Iran that really caused this mission very nearly to fail."
Ahead of the invasion, Mr Blair said discussions over the handling of the war-torn country had taken place.
"We focused very much on what we would find and how we would deal with it," he said.
Hundreds of millions of pounds were pumped into the conflict, Mr Blair said.
But he added: "What became clear in time was not a lack of resources but a lack of security."
Mr Blair told the inquiry British forces had been properly funded throughout.
"I don't think I refused a request for money or for equipment at any point in the time that I was prime minister," he said.
"And my view, very strongly, is that when you are asking your armed forces to go into this situation, you put everything to one side - other than making sure they have the equipment they need and they have the finances there to back it up."
Planning for a possible invasion was under way by the end of 2002, Mr Blair said.
"I think it was at the end of October 2002 Geoff Hoon (then defence secretary) said we've really got to get on with this - and we did," Mr Blair told the panel.
He said he had been "assured" the military was ready for battle.
"I needed to know from that, they could do it. and that they would be ready - and that's what they assured me," he said.
He went on: "If anyone had come to me and said it not safe to do this because of the lack of proper military preparation, I would have taken that very seriously.
"But they didn't and they got on with it - and they did it magnificently, as they always do."