The House passed a sweeping two-year budget deal Thursday that increases spending for military and domestic programs and suspends the debt ceiling through mid-2021, sending the White House-backed legislation to the Senate.

A large majority of Democrats voted for the legislation, while a majority of Republicans opposed it despite appeals from President Trump to support the bill.

The 284-149 vote was one of the last acts by the House before lawmakers leave Washington for a six-week summer recess. The Senate is expected to act on the bill next week and send it to Trump for his signature before senators, too, abandon the Capitol for the summer.

Supporters called the legislation a signal product of divided government, a compromise with something for everyone to love or hate. Democrats touted increases in domestic spending; Republicans pointed to growth in the Pentagon budget.

And lawmakers in both parties applauded the deal for ratcheting down the budget brinkmanship that characterized the first years of the Trump administration and led to the nation’s longest government shutdown over 35 days this past winter. Facing warnings that the Treasury Department could run out of money to pay its bills as early as September, lawmakers voted to suspend the nation’s borrowing limit until July 31, 2021, removing the threat of a catastrophic, first-ever default.

“Every now and then you need to sit down and put what’s good for the American people first,” said Rep. Tom Cole (R-Okla.). “We all know that a catastrophic debt- ceiling crisis and default, what that would do to our economy, how many people that would put out of work. . . . These are huge, huge wins.”

But conservative Republicans expressed opposition to the deal because it increases spending by $320 billion over existing law and suspends the debt ceiling without doing anything to rein in the spiraling deficit and debt.

Many of these lawmakers were unmoved by Trump’s support for the deal, even after he wrote on Twitter ahead of the vote: “House Republicans should support the TWO YEAR BUDGET AGREEMENT which greatly helps our Military and our Vets. I am totally with you!”

Trump also held a conference call with several dozen fence-sitting House Republicans on Thursday to urge them to back the legislation. But even some close Trump allies shrugged off the president’s views, especially as it became evident the legislation was going to pass with or without their votes.

“We don’t believe we should bankrupt America,” said House Freedom Caucus Chairman Mark Meadows (R-N.C.). “We have a difference of opinion on this particular issue, one that’s not going to change.” Unlike in some past budget battles, where Meadows and other conservatives lobbied Trump until the end to oppose bipartisan compromise, Meadows said that after making his views known, he had not tried to change the president’s mind.

Support from Democrats was overwhelming, despite some early concerns that liberals might defect over Pentagon spending in the bill, or a side agreement to limit controversial policy provisions on issues such as Trump’s border wall.

“It’s not a perfect deal by any means,” the Congressional Progressive Caucus said in a statement. “However, it will allow for major, long-overdue investments in domestic priorities — including housing assistance, food aid, education and job training.”

The deal was supported by 219 Democrats and 65 Republicans, while 16 Democrats, 132 Republicans and one independent voted “no.”

Immediately following passage of the legislation, conservative Rep. Thomas Massie (R-Ky.) used a procedural maneuver to force a vote on changing the title of the bill from the “Bipartisan Budget Act of 2019” to “A bill to kick the can down the road, and for other purposes.” His effort was defeated 384-47.

Senate Majority Leader Mitch McConnell (R-Ky.) said that by increasing Pentagon spending, the deal “achieves the No. 1 goal of the Republican side of the aisle, providing for the common defense.” He said he expects the Senate to pass the legislation next week with bipartisan support.

The deal does not eliminate the threat of a government shutdown when federal spending runs out Oct. 1, because Congress still has to pass individual spending bills to fund federal agencies. But by setting top-line spending numbers, the deal makes it easier for lawmakers to agree on those bills. And by suspending the debt limit through July 31, 2021, well past the presidential election, the deal eliminates chances of a catastrophic default amid warnings that Treasury could run out of money to pay its bills as early as September.

The deal increases total discretionary spending from $1.32 trillion in the current fiscal year to $1.37 trillion in fiscal 2020 and $1.375 trillion the year after that. Discretionary spending is the money controlled by Congress and does not count programs such as Social Security and Medicare.

The deal was largely negotiated between House Speaker Nancy Pelosi (D-Calif.) and Treasury Secretary Steven Mnuchin. It marks the last gasps of the 2011 Budget Control Act, which sought to put strict controls on federal spending. Instead, Congress came together every two years to overrule the law’s spending caps and increase Pentagon and domestic budgets. The law will expire after this final deal. Republicans say that the Budget Control Act had the benefit of putting some constraints on spending, but many Democrats are delighted to see it go.

The government is expected to spend $4.4 trillion this year, but bring in much less revenue. The gap of roughly $1 trillion is known as the deficit, and the government must borrow money to cover this difference by issuing debt.

The deficit and the debt have risen markedly during the Trump administration, a major pivot from GOP demands during the Obama administration that the deficit should be eliminated. Trump has said the tax cuts and spending increases he has pursued were necessary to juice economic growth, but the economy appears to be slowing, raising questions about the effectiveness of his approach. And critics have alleged that the rosy economic outlook White House officials promised will not be sustainable, leaving the government with mounting debt and higher costs.

The negotiation between Pelosi and Mnuchin could represent a new blueprint for Washington budget talks, as the treasury secretary brought a more pragmatic approach to the discussions than some other officials had wanted.

Some White House officials, particularly acting chief of staff Mick Mulvaney and acting budget director Russell Vought, had advocated for tougher measures to try to cut spending, but did not prevail. Mnuchin was focused on raising the debt ceiling and a drama-free process that he hoped would not damage the economy, and he persuaded Trump to back the bill.