British forces will not "walk away" from Iraq or Afghanistan until their job there is done, Tony Blair has said.
To pull out would leave enemies and extremists "heartened and emboldened", he told his monthly press conference.
British army chief General Sir Richard Dannatt has warned that UK troops "exacerbated" Iraq's security problems and should withdraw "sometime soon".
But Mr Blair said that the general was not calling for the immediate withdrawal of British troops from Iraq.
"Of course, it is the case that for some of those areas in Iraq, particularly where the Iraqi forces now want to take control of those areas, it is important that we don't overstay the time that we need to be there," he said.
"But in no sense was he saying - and neither should anybody say - that we should get out of Iraq before the job is done."
However, Liberal Democrat leader Sir Menzies Campbell urged Mr Blair to "outline a new strategy for Iraq".
"Tony Blair fails to accept that Richard Dannatt was talking about a matter of months, not years, as the length of time before British troops withdraw from Iraq," he said.
US troop withdrawal?
But Mr Blair argued that to walk away from either Afghanistan or Iraq "will leave a situation in which the very people we are fighting everywhere, including the extremism in our own country, are heartened and emboldened and we can't afford that to happen.
"So we have got to see that job through."
He added that the UK was "on the side of ordinary, decent Muslims in Iraq or Afghanistan who want their own democratic government" and there "at the behest of those governments with a full United Nations resolution".
It was wrong to argue that "we somehow are causing... extremism".
Former US Secretary of State James Baker is compiling a report which, it has been reported, could recommend the large-scale withdrawal of troops from Iraq.
However, Mr Blair said he would be "absolutely astonished" if the report set out plans to "get out of Iraq come what may".
The prime minister also used the news conference to signal his support for military-managed NHS wards for the treatment of injured servicemen and women returning from Iraq and Afghanistan.
The closure of most military hospitals means wounded service personnel are treated along with civilian patients within the NHS.
Some recuperating soldiers are said to have faced hostility from anti-war protesters.
Mr Blair said: "We should do the very best for our armed forces when they're injured in combat.
"And the expert advice that we have is that for some of the most difficult injuries, they are best treated within the specialist service of the NHS.
"But there is a case - and we are looking at it actively now - for having military-managed wards within the NHS where these servicemen or women can go, because it is important they get the best care, but also in an environment with which they feel comfortable, and we will try and do that."
The prime minister said an announcement would be made soon.