The $106-billion measure, which passed, 226 to 202, provides the money to escalate the war in Afghanistan and wind down U.S. involvement in Iraq. It also contains a hodgepodge of other provisions.

WASHINGTON — Sidestepping opposition from antiwar liberals, the House on Tuesday approved funding to escalate the war in Afghanistan and wind down U.S. involvement in Iraq.

The $106-billion war funding bill, approved 226 to 202, posed the toughest test yet of President Obama's ability to rally his party's left wing, which views his foreign and military policies as too hawkish.

Administration officials and Democratic leaders intensely lobbied holdouts among the Democratic ranks in advance of the House vote. The result was close because only five Republicans supported the bill and 32 antiwar Democrats opposed it.

The legislation carried a hodgepodge of provisions, including $5 billion to expand the role of the International Monetary Fund in shoring up the world economy, $1 billion to encourage U.S. consumers to trade in gas-guzzlers for more fuel-efficient new cars and $7.7 billion to combat the flu pandemic.

The bill also would place limits on the administration's ability to bring terrorism suspects to the United States from the Guantanamo Bay detention facility in Cuba.

Another battle looms before the measure goes to Obama for his signature: In the Senate, which is expected to vote on the bill this week, a bipartisan coalition may try to strip out the money for car trade-ins.

When an earlier version of the bill passed the House in May, 51 Democrats opposed it -- mostly because they had long-standing objections to the Iraq war. But 168 Republicans joined 200 Democrats in approving it, marking the first time that Obama had to rely on GOP lawmakers to deliver the votes needed to pass a major bill.

Then in the Senate, Democrats added the money for the IMF, which Obama had requested to make good on his promise to European leaders to bulk up contributions to the global body to stimulate the world economy.

But House Republicans vigorously objected to the addition, saying IMF money had no place in legislation for war spending. They worried that the money would end up in the hands of Iran and other enemies of the United States.

The final version of the bill, drafted in a House-Senate conference committee, included the IMF money, provoking mass defections by Republicans on Tuesday. Rep. Howard P. "Buck" McKeon (R-Santa Clarita) called it a "global bailout."

But Democrats argued that the IMF money would improve U.S. security by helping to ameliorate the economic suffering that can fuel terrorist recruitment in poor nations.

With Republicans promising to oppose the bill, Democratic leaders turned to their rank and file for the 18 additional votes they needed to pass it.

Administration heavyweights -- including Obama's chief of staff, Rahm Emanuel, and Secretary of State Hillary Rodham Clinton -- phoned wavering House Democrats. In a midday private meeting of the Democratic caucus, House leaders told colleagues they needed 10 more converts to prevail. House Majority Whip James E. Clyburn (D-S.C.) ratcheted up the pressure by calling on dissenters by name.

Rep. George Miller (D-Martinez), who had opposed the bill in May, decided to switch sides rather than risk delivering a high-profile defeat to Obama.

"I'm against the war," Miller said, but he thought the funding was necessary to "clean . . . up after the Bush administration."

Most of the money, $80 billion, will go to the Pentagon for military operations in Iraq and Afghanistan. The bill also includes $400 million for helping train Pakistani military personnel in counterinsurgency tactics.

More than $2 billion was included in the bill for eight additional Boeing C-17 cargo planes, despite efforts by the Obama administration to end production.

The $5 billion for the IMF will finance U.S. guarantees enabling loans to poor nations worth $108 billion.

The bill does not include the $80 million Obama requested to close the detention facility in Guantanamo Bay. It also bars the administration from releasing detainees from the Cuban facility to freedom in the United States, at least until Sept. 30. It would, however, allow the administration to bring certain prisoners to U.S. jails for pretrial detention.