WASHINGTON — The House on Friday overwhelmingly passed a $649 billion defense spending bill that boosts the Pentagon budget by $17 billion and covers the costs of wars in Iraq and Afghanistan.

The strong bipartisan vote was 336-87 and reflected lawmakers' intent to ensure national security, preserve defense jobs across the nation and avoid deep cuts while the country is at war.

While House Republican leaders slashed billions from all other government agencies, the Defense Department is the only one that will see a double-digit increase in its budget beginning Oct. 1.

Amid negotiations to cut spending and raise the nation's borrowing limit, the House rejected several amendments to cut the Pentagon budget, including a measure by Rep. Barney Frank, D-Mass., to halve the bill's increase in defense spending.

"We are at a time of austerity. We are at a time when the important programs, valid programs, are being cut back," Frank said.

Scoffing at the suggestion that "everything is on the table" in budget negotiations between the Obama administration and congressional leaders, Frank said, "The military budget is not on the table. The military is at the table, and it is eating everybody else's lunch."

Still, the overall bill is $9 billion less than President Barack Obama sought. The White House has threatened a veto, citing limits on the president's authority to transfer detainees from the U.S. prison at Guantanamo Bay, Cuba, and money for defense programs it didn't want.

The measure includes $119 billion for the wars in Iraq and Afghanistan.

The House also voted to slow repeal of the policy allowing gays to serve openly in the military, backing an amendment to block funds for the training manual for the Chaplain Corps on ending the so-called "don't ask, don't tell" policy.

Rep. Tim Huelskamp, R-Kan., sponsor of the amendment, said its purpose was to prohibit chaplains from performing same-sex marriages on Navy bases regardless of a state's law. The House approved the measure 236-184.

The overall bill must be reconciled with a still-to-be-completed Senate version.

The final vote came after the House turned back an amendment by Democratic Rep. Dennis Kucinich of Ohio that would have barred funds for the U.S. operation against Libya. The vote was 251-169.

The House has sent mixed signals on Obama's military action against Libya, voting to prohibit weapons and training to rebels looking to oust Moammar Gadhafi but stopping short of trying to cut off money for American participation in the NATO-led mission.

In a series of votes Thursday, Republicans and Democrats expressed their dissatisfaction with the Libya operation, now in its fourth month with no end in sight and waning support from some nations in the international coalition. The House voted to bar military aid to the rebels but moments later rejected efforts to prevent funding for the limited U.S. mission.

The votes mirrored the contradictory actions of the House last month, when lawmakers refused to approve the operation but declined to cut off the money.

The congressional unrest over Libya stems from a stalemated civil war and Obama's contention that he didn't need congressional authorization to engage in another war on top of Afghanistan and Iraq because Libya fighting isn't full-blown hostilities. Among war-weary NATO allies, Italy announced that it was reducing its participation in the campaign by removing an aircraft carrier from the region and pulling thousands of troops home.

"Libya did not attack us. Libya did not attack NATO," Rep. Tom Cole, R-Okla., said. "However much we detest Mr. Gadhafi and his regime, we have no reason to be at war."

The House voted 225-201 for an amendment sponsored by Cole to bar the Pentagon from providing "military equipment, training or advice or other support for military activities" to an outside group, such as rebel forces, for military action in or against Libya.

Forty-eight Democrats backed the Republican-sponsored measure.

The intent of the measure was to prohibit aid to the rebels such as weapons and assistance to their Transitional National Council, including operational planning. The broad effort also would target contractors in Libya.

Obama already has authorized $25 million in nonlethal assistance to the rebels, including thousands of meals from Pentagon stocks. The U.S. also has supplied $53 million in humanitarian aid. Neither would be affected by the bill.

Moments after that vote Thursday, the House rejected a measure that would have prohibited funds for the U.S. military to continue its limited role. The vote was 229-199, with 67 Democrats breaking with the administration to support the amendment, which Kucinich cosponsored with freshman Rep. Justin Amash, R-Mich.

Lawmakers argue that Obama violated the 1973 War Powers Resolution, which requires a president to seek congressional approval within 60 days of the first military strikes, a move the commander in chief did not make.

In a reflection of congressional anger toward the administration, the House voted overwhelmingly for an amendment that prohibits spending that violates the War Powers Resolution and focuses on future military operations.

The House also rejected two other efforts to prohibit funds for the U.S. military operation in Libya.

Sen. John McCain, top Republican on the Senate Armed Services Committee, criticized the House vote on aid to the rebels, arguing that it sends the wrong message to Gadhafi and those challenging the long-time leader.

"I am saddened by the abandonment of America's traditional support for those struggling for freedom and democracy, which has been a hallmark of our Republican Party for decades," said the Arizona Republican, who traveled to Benghazi in April to meet with the rebels.

Since NATO took command of the Libya operation in early April, the U.S. role has largely been limited to support efforts such as intelligence, surveillance and electronic warfare. The U.S. has launched drone attacks and other airstrikes, flying more than 3,400 sorties.

The Senate has delayed consideration of a resolution authorizing the U.S. mission in Libya.