WASHINGTON - House and Senate negotiators reached agreement yesterday on war-funding legislation that would begin bringing U.S. troops home from Iraq as early as July, setting a goal of ending U.S. combat operations by no later than March.

The $124 billion bill, slated for final votes in the House and Senate tomorrow and Thursday, sets up a veto clash with President Bush by week's end.

Some congressional Democrats had considered making advisory all dates for withdrawing U.S. troops in the hopes of persuading Bush to sign the bill. But with the president standing firm on his plans to veto any language on the timing of the war, Democratic leaders stuck to binding dates for initiating troop pullouts.

"Our commitment is not endless," said Sen. Patty Murray (D., Wash.), who said the legislation "sets us on a path with the best chance of achieving success in Iraq."

Rep. Jerry Lewis (R., Calif.) called it "a message of surrender. We all know this bill is going nowhere."

The legislation would maintain House-passed language that set strict requirements for resting, training and equipping troops. But the legislation would grant the president the authority to waive those restrictions, as long as he publicly justified the waivers.

The bill also establishes benchmarks for the Iraqi government to meet, including the creation of a program to disarm militias. The benchmarks require reductions in sectarian violence, the easing of rules that purged the government of all former Baath Party members, and passage of a law on sharing oil revenue.

Although withdrawals would have to begin on set timetables, the bill does not say how many troops would begin to leave or how the withdrawals would proceed. And because the bill would allow troops to stay for training and counterterrorism missions, Democrats said they were trying to force a change in strategy, not an end to the war.

Unless the Bush administration determines by July 1 that those benchmarks are being met, troops would begin coming home immediately, with a goal of completing those withdrawals by the end of the year. If benchmarks are being met, troops would begin coming home no later than Oct. 1, with a goal of completing the troop pullout by April 1, 2008.