WASHINGTON – The House of Representatives Thursday passed a two-year budget bill ironed out between President Donald Trump and congressional Democrats, removing the threat of deep automatic cuts in domestic programs and the military.

But the deal also infuriated some of Trump's closest allies in the U.S. Congress, who criticized the agreement as fiscally irresponsible.

The budget legislation passed284-149, with support coming overwhelmingly from Democrats. More than twice as many Republicans voted against it than for it.

Some conservative lawmakers took to social media to express their criticism, including Rep. Jody Hice, R-Georgia, who said that lawmakers "should be working around the clock" to come up with a budget deal that includes much more modest spending and keeps the country "on a track to fiscal solvency."

One Republican opponent of the measure, Rep. Thomas Massie, R-Ky., sought to rename it "The Kick the Can Down the Road Act." His motion failed.

In a statement issued after the vote, FreedomWorks, a group closely aligned House conservative lawmakers, said "any Republican who voted for this bill and still has the audacity to call himself or herself a fiscal conservative should probably consider changing his or her party affiliation.”

The group had labeled the bill "horrific" and "abysmal."

The Senate is expected to take up the bill in the coming days.

House Speaker Nancy Pelosi, D-Calif., had urged passage of the House bill, as had Trump.

“This is not about future spending ⁠— this is about paying for what we have invested in already," she said.

Trump encouraged reluctant Republican lawmakers to support the bill, touting its increases in spending for the military and veterans' programs.

At a press conference Thursday morning, House Minority Leader Kevin McCarthy acknowledged that some House Republicans would vote against the measure but blamed Democrats for the increase in spending.

"We are living in a world where the new socialist Democrats are in the majority," McCarthy said.

The deal removes the threat of deep, automatic spending cuts that have hung over budget negotiations since Congress first approved them eight years ago as a way to force a compromise. It also guarantees the government’s ability to continue borrowing by raising the debt ceiling for the next two years.

The agreement provides a broad outline for $2.7 trillion in spending over the next two years. That amounts to a $320 billion increase over existing spending limits.

Non-defense appropriations would increase by $56.5 billion over two years, giving domestic programs 4% increases on average in the first year of the pact. Defense appropriations would increase by $46.5 billion over those two years, with the defense budget hitting $738 billion next year, a 3% hike, followed by only a further $2.5 billion increase in 2021.

Tough decisions are still ahead. Because the agreement provides only a broad spending outline, appropriators will have to decide this fall how much money to allocate to individual programs, a contentious process that often touches off intense partisan squabbles.

After striking the deal with Trump, Pelosi and Senate Minority Leader Chuck Schumer, D-N.Y., welcomed the agreement, saying it would avoid automatic cuts in government programs that would have been "devastating."

But several House Republicans voiced alarm over the spending.

The House Freedom Caucus, a group of more than 30 Republican lawmakers, has vowed to vote against the bill, saying its members have "grave concerns" about it.

The group, which includes many of Trump's closest allies in the U.S. Congress, called the legislation a "spending frenzy" and said it would put the country on a path to "fiscal insolvency."

There also has been disappointment among some Republican senators.

Sen. Ted Cruz, R-Texas, called the deal "a missed opportunity."

Sen. Michael Braun, R-Ind., said the legislation was an "embarrassment" that would burden future generations with debt.

Braun said he wanted to see Republicans "go back to our conservative roots of paying for things as we spend."

“It’s our kids and our grandkids that are going to be sorting this all out and paying for it,” he added.

Freedom Caucus member Rep. Chip Roy, R-Texas, was “gratified” to see a majority of House Republicans vote against the bill, and by a wide margin. “I think it’s a bad deal for America, I think racking up debt off the backs of the men and women in uniform in the very name of supposedly providing resources for them is a bad thing,” he said.

Contributing: Michael Collins and The Associated Press