WASHINGTON -

The Democratic-controlled House voted Thursday night to pay for military operations in Iraq on an installment plan, defying President Bush's threat of a second straight veto in a fierce test of wills over the unpopular war.

The 221-205 vote was largely along party lines and sent the measure to a cool reception in the Senate, where Majority Leader Harry Reid, D-Nev., is seeking a compromise with the White House and Republicans.

Under growing political pressure from Republicans, Bush coupled his veto threat with a sign of flexibility. Visiting the Pentagon, he said he was willing to sign a military money bill that includes political and military goals for the Iraqi government.

"Time's running out, because the longer we wait the more strain we're going to put on the military," said the president, who previously had insisted on what he termed a "clean" war funding bill.

Bush and key lawmakers have expressed increased frustration with the government in Baghdad in recent weeks, and Iraqi Deputy Prime Minister Barham Saleh spent his day appealing to key senators for patience.

In a brief interview with The Associated Press, Saleh said he had sought to convey the "imperative of success against terrorism and extremism" in the Middle East.

Bush vetoed an Iraq funding bill last week, objecting to a timetable for troop withdrawal that was included as well as several billion dollars for domestic programs. After failing to override the veto, Democrats began work on a replacement measure, hoping to clear a bill the president will sign within two weeks so the flow of money to the troops is not interrupted.

That will inevitably require the party's rank and file to make additional concessions. The withdrawal timetable already has been jettisoned. But for the time being Speaker Nancy Pelosi of California has decided to defy Bush before negotiating with him.

"Democrats are not going to give the president a blank check for a war without end," she said, advancing two bills for votes during the day that challenged the commander in chief's conduct of the war.

The first would have required the withdrawal of U.S. combat forces from Iraq within nine months. It fell, 255-171, with almost all Republicans in opposition along with 59 Democrats. Majority Leader Steny Hoyer, D-Md., was among them.

"This war is a terrible tragedy and it is time to bring it to an end," said Rep. James McGovern, D-Mass., the leading advocate of the withdrawal measure. "For four long, deadly years, this administration and their allies in Congress have been flat wrong about Iraq."

Republicans argued that a withdrawal would be disastrous.

"Now is not the time to signal retreat and surrender. How could this Congress walk away from our men and women in uniform," said Rep. Jerry Lewis, R-Calif.

A few hours later, the House passed legislation providing funds for the war grudgingly, in two installments. The first portion would cover costs until Aug. 1 -- $42.8 billion to buy equipment and train Iraqi and Afghan security forces.

Under the bill, it would take a summertime vote by Congress to free an additional $52.8 billion, the money needed to cover costs through the Sept. 30 end of the fiscal year.

Rep. John Murtha, D-Pa., said the bill was an attempt to provide accountability for a war gone wrong. He said the last four months have been the deadliest of the war for U.S. troops.

But Rep. John Boehner of Ohio, the Republicans leader, argued the bill "is designed to bring failure in Iraq" which he said "means chaos in Iraq. It means genocide in Iraq."

Democratic officials, speaking privately, said Pelosi had agreed to allow the vote on the withdrawal measure in the hope that her rank-and-file would then unite behind the funding bill.

But in an increasingly complex political environment, even that measure was deemed to be dead on arrival in the Senate, where Democrats hold a narrow advantage and the rules give Republicans leverage to block legislation.

In a speech in January, Bush listed several goals for the Iraqis, including legislation to share oil revenue among all Iraqis, spending $10 billion on job-creating reconstruction projects, holding provincial elections, overhauling de-Baathification laws and creating a fair process for considering amendments to the constitution.

Republicans say it is unlikely Bush would sign legislation that makes war funds contingent on progress by the Iraqi government. But several key Republicans have suggested withholding Iraqi reconstruction funds if the benchmarks go unmet, and it seems likely the White House will face intense pressure to agree.

Republican lawmakers have growing increasingly restive about a war that they believe cost them their congressional majorities in last fall's elections. In a private meeting with Bush and several key administration officials at the White House, 11 moderate GOP lawmakers bluntly told Bush that the status quo was unsustainable and could mean further election losses next year.

But Pelosi and Reid face obstacles of their own.

They are determined to make sure that essential funding for the war is not cut off. At the same time, they are laboring to keep faith with their own rank-and-file, with the war-weary voters who installed them in power, and with MoveOn.org and other groups whose overriding goal is to force the withdrawal of the U.S. combat troops.