The US House of Representatives has narrowly approved a bill making further funding of the war in Iraq conditional on a timetable for a US troop pullout.
The bill would require US troops to start leaving Iraq in October
The bill provides $100bn in new war funds, if troops start leaving in October, with the withdrawal planned to be complete by March 2008.
President Bush has repeatedly threatened to veto the bill.
The commander of US forces in Iraq, General David Petraeus, had met lawmakers to argue against the bill.
Republicans and Democrats have been in deadlock on the legislation for weeks, and it finally passed by 218 votes to 208.
The $124bn bill would pay for military spending in Iraq and Afghanistan, and the Senate is due to vote on the bill later on Thursday.
"Tonight, the House of Representatives voted for failure in Iraq - and the president will veto its bill," said White House spokeswoman Dana Perino.
Although the Democrats control both houses of Congress, they do not have enough votes to overrule a presidential veto.
If President Bush does veto the bill, temporary measures are expected to be tabled to provide funding until the summer.
Before Wednesday evening's debate, Gen Petraeus was trying to gain support for Mr Bush's plan to increase troop numbers in Iraq, the so-called "surge", to improve stability.
Gen Petraeus lobbied against the bill
"General Petraeus continued to say that he can give a comprehensive assessment as to whether or not the surge is in fact working around September," said Democratic Representative James Clyburn.
Not all the new extra US forces planned for deployment are yet in place in Iraq.
The Iraqi foreign minister also criticised the Democrats' bill.
Speaking to the BBC while on a visit to Iran, Hoshyar Zebari said efforts by Congress to set a date of October for troops to start leaving Iraq would not help his country's security or political development.
Dr Zebari said he was amazed people had started talking of a timetable when the UN resolution giving the US-led coalition its mandate would be reviewed in June, and then again at the end of the year.
The minister also stressed withdrawal of US troops would have to wait for the Iraqi military to be self-reliant.
Dr Zebari is in Tehran to press the Iranian government to take part in a key regional summit next week in Egypt on the future security of Iraq.
"The sacrifices borne by our troops and their families demand more than the blank cheques the president is asking for, for a war without end," said the leader of House Democrats, Nancy Pelosi.
She urged the president to sign the bill, so that "we can focus on winning the war against terrorism, which is the real threat to the American people".
But Republicans have vowed to back the president's refusal to support what they call a "surrender date".
"Al-Qaeda will view this as the day the House of Representatives threw in the towel," said Republican Jerry Lewis.
Mr Bush shows no signs of budging from his determination to veto any bill tying war spending to a timetable for troop withdrawal.
The legislation was an attempt to "handcuff our generals, add billions of dollars of unrelated spending and begin to pull out of Iraq by an arbitrary date", he said on Tuesday.
"To accept the bill proposed by the Democratic leadership would be to accept a policy that directly contradicts the judgement of our military commanders."