Iraq faces greater bloodshed and instability if British troops are withdrawn too early, Foreign Secretary Margaret Beckett has said.
Mrs Beckett said British troops would not leave Iraq too early
Iraqi authorities would be unable to stop the country, already "dangerous and volatile", being turned into a base for terrorism, she told a conference.
"We must not let that happen. In both Afghanistan and Iraq we have to have the courage of our convictions."
She also said anger at foreign policy could not justify terrorism.
"There is no path in reason or logic that connects disagreeing with military action against Saddam Hussein and setting out deliberately to kill civilians including Muslims on a Tube or bus in London," she said.
Mrs Beckett was addressing the Royal United Services Institute, a foreign affairs think tank, in London on Thursday.
It follows comments from the head of the British Army, Sir Richard Dannatt, that the presence of British troops "exacerbates the security problems in Iraq". The Lib Dems have called for a "phased withdrawal" of troops.
But Mrs Beckett said: "We will leave when they are confident that they can take the role of security in the country on their own shoulders.
"I ask those who are calling for more precipitous action to consider the consequences of such action.
"We would be leaving the Iraqi government without the means to prevent a further escalation in the violence, without the tools to enforce the rule of law and without the authority to prevent their country from turning into a base for terrorism."
She also said she was not anticipating any "major upheaval" in US policy on Iraq, despite the mid-term election defeats for President Bush's Republican party.
The Baker review of US policy was likely to have a bigger impact, she said, but anticipated a "reassessment" rather than major changes.
Defence Secretary Des Browne and Foreign Office Minister Kim Howells have both suggested that local forces should be able to take over from British troops within a year or so.
Mrs Beckett also called on the UK's 1.6m Muslims to speak out against extremism while travelling abroad, to act as ambassadors for Britain.
"The Muslim communities in this country did not ask terrorists to act in their name, the vast majority are sickened by the slur on their great and noble faith," she said.
"When fellow Muslims speak up against extremism and correct the distorted, the skewed world-view of the terrorists, it's much more powerful, much harder to dismiss than when those same words are spoken by a government minister."
She pointed out that MI6 now has more people in more countries than ever before and that MI5 has more frontline staff in Britain than at any time since World War II - all working to prevent attacks.