Some Democrats want US troops to be brought home now

The Senate narrowly rejected a Republican amendment that would have removed the withdrawal clause from a bill on military funding.

The vote is a boost for the Democrats, but Mr Bush has vowed to veto any bill setting out a timetable for withdrawal.

The House of Representatives also backed withdrawal in a vote last week.

The House bill, which imposes a 31 August 2008 deadline for pulling troops out, was passed narrowly by 218 votes to 212 on Friday.

Both pieces of legislation are tied to more than $120bn (£60bn) in emergency funding for US troops in Iraq and Afghanistan.

A final Senate vote on the whole funding bill will take place later this week. It will need the support of a dozen Republicans to pass.

'Must change course'

HAVE YOUR SAY This is definitely a step in the right direction, momentum is growing to end the war

Dylan, South Carolina

Send us your comments

The latest vote was an important and somewhat surprising victory for the Democrats in the latest Congressional skirmish over the war in Iraq, reports the BBC's James Coomarasmy in Washington.

Two weeks ago, Senate Democrats failed to pass legislation setting a timetable for withdrawal, but two more senators sided with them this time, giving them a victory by 50 votes to 48.

Senate Majority Leader Harry Reid called the vote a significant step forward and a pointed message to Mr Bush.

"With this vote, the Senate is giving our troops the resources they need in combat - including a strategy in Iraq worthy of their sacrifices," he said.

"The president must change course, and this legislation gives him a chance to do that," he said.

But there were no concessions from the White House.

Mr Bush "is disappointed that the Senate continues down a path with a bill that he will veto and has no chance of becoming law," his deputy press secretary, Dana Perino, said in a statement.

And a presidential hopeful, Republican John McCain, said setting a schedule for pulling troops out of Iraq would encourage insurgents.

Republican Senator Lindsay Graham said the Democrats had picked a wrong and dangerous fight:

"Whatever mistakes the Bush team have made - and there are many - the Congress is about to make the greatest mistake of all and that is to tell the enemy what they have to do to get us out of Iraq on their terms, not ours.

"It is a death blow to moderation."