House Armed Services Chairman Mac Thornberry (R-Tex.) drafted the Pentagon spending bill. (Evy Mages/Getty Images)

The House approved the annual Pentagon policy bill Friday after a tense debate over funding limits on federal agencies and a fight over an immigration amendment that was the latest example of Republican reluctance to tackle that issue.

On a 269 to 151 vote, the annual National Defense Authorization Act cleared the House with near-unanimous Republican support and the backing of nearly a quarter of Democrats. That was an unusually low level of support — the bill received 325 votes in 2014.

The nearly $612 billion proposal, matching President Obama’s request, actually has broad bipartisan support, based on the 60 to 2 vote approving it earlier this spring in the House Armed Services Committee. But Democrats largely opposed the measure Friday because of their demands for new negotiations to set up different spending limits on defense and non-defense agencies that were imposed by the 2011 Budget Control Act.

The bill, drafted by Rep. Mac Thornberry (R-Tex.), the Armed Services chairman, used some budgetary maneuvering to reach that level of spending without technically breaking the cap of $515 billion in defense spending for 2016. As other committees have done in mapping out 2016 budgets, Thornberry’s panel tacked on nearly $90 billion in funds from an off-budget account used primarily for the Middle East wars.

“Recognizing that our first responsibility is to protect and defend, Democrats stand for a strong national defense. That is why we support lifting the sequester and fully funding the president’s defense budget request,” House Minority Leader Nancy Pelosi (D-Calif.) wrote to her Democratic colleagues late Thursday night.

The “sequester,” as it is known, is the extra stringent spending limit that kicked in two years ago. After a 16-day government shutdown in October 2013, Congress reached a bipartisan deal that provided some relief from sequestration. But that deal ended this year, and now lawmakers on both sides of the aisle are working to find ways around the spending limits that they imposed on themselves four years ago.

The biggest hurdle the legislation faced was the immigration dispute, prompted when freshman Rep. Ruben Gallego (D-Ariz.) added in committee legislation that would have encouraged the Pentagon to allow young immigrants brought here illegally by adults to serve in the military.

Under an executive order from Obama three years ago, those children — called Dreamers, after the DREAM Act — are no longer eligible for deportation. Some states are offering them benefits such as in-state tuition, and Gallego wants to allow them to serve in the military without fear of penalty even though they are not legally documented.

A few dozen conservatives who oppose Obama’s actions on immigration threatened to oppose the entire Pentagon bill if this one provision were in the legislation. With Democratic support so tenuous, GOP leaders feared the entire bill would fail.

Late Thursday Rep. Mo Brooks (R-Ala.), one of the staunchest opponents of illegal immigration in Congress, won a party-line vote to strip out Gallego’s language. Just 20 Republicans opposed Brooks.

Thornberry argued that immigration issues should be tackled in other legislation, not in a bill delivering funds for troops fighting overseas and protecting the homeland. He said that the broader funding questions should not block approval of this bill.

“It is a very hard argument to make that we are going to oppose the bill that takes care of our men and women in the military because we want to try to pressure Congress and the president to reach an agreement on spending on other stuff,” Thornberry said.

The House-passed bill also includes an amendment from Rep. John Delaney (D-Md.) and Duncan D. Hunter (R-Calif.) that would create a new “hostage recovery coordinator” to oversee efforts to secure the return of Americans taken captive overseas. The measure would also seek to improve communications with hostages’ families. Delaney represents the district that was home to Warren Weinstein, an American who was killed in a U.S. drone strike in January.

Missy Ryan and Adam Goldman contributed to this report.