WASHINGTON - The House of Representatives on Tuesday narrowly backed a $106 billion bill to pay for the U.S. wars in Iraq and Afghanistan and extend billions in new credit to the International Monetary Fund.

The legislation also includes extras like vouchers to spur U.S. car sales, and comes after a series of political battles that exposed the sharp fissures between President Barack Obama's Democrats and the Republican minority.

The spending bill, which now heads to the Senate for consideration, marks a step forward for Obama's agenda for winding down the Iraq war and boost operations in Afghanistan where militants are entrenched.

Obama and his fellow Democrats who control both chambers had to fight hard for the bill. But in the 226-202 vote, they managed only to get five Republican votes and saw 32 Democrats vote against it.

Almost all Republicans withdrew support for the war funding bill because provisions were added by the Senate to provide $108 billion in new credit lines for the IMF to help the agency ease countries through the global financial downturn.

Some Democrats appeared to question Republican support for the troops since it was largely focused on funding the wars.

Eighty percent or more of this bill is to support the young men and women, and some not so young, who we have sent in harm's way in Iraq and Afghanistan to confront terrorism, House Democratic Leader Steny Hoyer said during floor debate.

But Republicans countered that the IMF funding should have been considered separately and expressed concern it could lend to U.S. foes like Iran or Venezuela -- even though the IMF currently has no loan programs with these countries.

Republicans support our troops, period, said Republican Representative Eric Cantor, who helped lead the opposition. The legislation also authorizes U.S. support for the IMF's plan to sell 400 tons (12.97 million ounces) of its gold reserves.

CASH FOR CLUNKERS

Lawmakers also tussled over $1 billion inserted in the bill to spur car sales through vouchers of up to $4,500 for Americans to junk less fuel-efficient vehicles and buy new cars that get better mileage.

Both Republicans and Democrats have complained that the bill's requirements for improving mileage are too small -- as little as two miles per gallon -- and have questioned inserting it into the war funding measure. Republican Senator Judd Gregg has said he may try to strip the program from the bill.

The bill also dealt with Obama's plans to close the U.S. prison at Guantanamo Bay, Cuba. A compromise was struck to permit Guantanamo terrorism suspects to be brought to the United States for trial but not for permanent detention.

The overall bill includes $79.9 billion for the wars plus $2.7 billion for eight Boeing Co C-17 military transport aircraft and seven Lockheed Martin C-130 planes that the Pentagon did not request.

It also has $1.4 billion in foreign aid to Pakistan, half for its counterinsurgency effort against militant Taliban forces.

The legislation also ballooned after Obama sought billions of dollars to combat the H1N1 flu virus which has now become a pandemic. Lawmakers nearly doubled his request of $4 billion to $7.7 billion, though $5.8 billion is contingent on needs.

(Editing by Eric Beech)