House-Senate bargainers agreed Wednesday on a $417 billion defense bill (search) that includes $25 billion for U.S. forces in Iraq and Afghanistan and funds to help battle Western wildfires (search).

The compromise measure, which is mostly for 2005, also has money for war refugees in Sudan (search) and American diplomats in Baghdad and Kabul. And it will provide $25 million each for buttressing security this summer in Boston and New York as they host, respectively, the Democratic and Republican presidential nominating conventions.

Congress is expected to approve the legislation next week, lawmakers' last stretch of work before recessing until September.

With troops under fire in Iraq and Afghanistan, President Bush and members of both parties want the measure completed before the political party gatherings. Speed is also a factor because lawmakers and the Pentagon are not sure there would otherwise be enough cash to pay for the two wars in the final weeks of the government's budget year, which runs through Sept. 30.

House Appropriations Committee Chairman Bill Young, R-Fla., and other lawmakers said the legislation includes the $25 billion Bush requested in May for U.S. operations in Iraq and Afghanistan. The money will be available as soon as the bill is enacted.

The $25 billion is expected to be less than half what will ultimately be needed for the two wars next year. The White House initially said the money would be unnecessary until after the November elections, but agreed to seek it sooner under pressure from Congress.

Bush requested the power to spend the $25 billion on virtually any war needs he perceived. The compromise bill will limit his flexibility to only about $2 billion, with the rest of the money provided to specific accounts, said Rep. John Murtha, D-Pa.

In an unusual move, the defense bill will also have $500 million for fighting this year's Western wildfires, said a House Appropriations Committee aide who spoke on condition of anonymity. That money was initially included in a separate Interior Department bill, but that measure is bogged down so lawmakers are switching it to the fast-moving defense legislation.

The blazes have already burned more than 3.4 million acres, almost double the 1.8 million-acre average of the past decade. The money would be on top of $2.3 billion provided at the beginning of the year to fight the fires.

The aide said the measure also contains $95 million to help Sudan's Darfur region, where war has killed an estimated 30,000 people, uprooted 1 million others and created widespread famine.

It also has $685 million to finance U.S. diplomats in Iraq and Afghanistan next year, including the costs of protecting them, the aide said.

The Bush administration has said it opposes the money for Sudan and the diplomats as "unnecessary at this time," but has not threatened a veto over those issues.

The bill contains money to give troops a 3.5 percent pay raise requested by Bush, and to start expanding the Army by 30,000 soldiers, Murtha said.

It also requires reports on the abuse of Iraqi prisoners by American troops and the U.S. relationship with Iraqi politician Ahmad Chalabi, a one-time ally accused of providing secret information to Iran, Murtha said.

The bill is the first of the 13 annual spending bills for next year ready for congressional passage. Because of a budget stalemate and other disputes, none of the other measures is likely to be ready soon, with the possible exception of one financing the Department of Homeland Security.