By Erica Werner and Jill Colvin | Associated Press

WASHINGTON — The top House and Senate Democrats said Wednesday they had reached agreement with President Donald Trump to protect thousands of younger immigrants from deportation and fund some border security enhancements — not including Trump’s long-sought border wall.

The agreement, the latest instance of Trump ditching his own party to make common cause with the opposition, was announced by Senate Democratic Leader Chuck Schumer and House Democratic Leader Nancy Pelosi following a White House dinner that Republican lawmakers weren’t invited to attend. It would enshrine protections for the nearly 800,000 immigrants brought illegally to this country as kids who had benefited from former President Barack Obama’s Deferred Action for Childhood Arrivals, or DACA, program, which provided temporary work permits and shielded recipients from deportation.

Trump ended the program earlier this month and gave Congress six months to come up with a legislative fix before the statuses of the so-called “Dreamers” begin to expire.

“We agreed to enshrine the protections of DACA into law quickly, and to work out a package of border security, excluding the wall, that’s acceptable to both sides,” Pelosi and Schumer said in a joint statement.

White House Press Secretary Sarah Huckabee Sanders partially disputed their characterization, saying over Twitter that “excluding the wall was certainly not agreed to.”

Either way, it was the second time in two weeks that Trump cut out Republicans to reach a deal with Pelosi and Schumer. A person briefed on the meeting, who demanded anonymity to discuss it, said the deal specifies bipartisan legislation called the DREAM Act that provides eventual citizenship for the young immigrants.

House Republicans would normally rebel over such an approach, which many view as amnesty for law-breakers. It remains to be seen how conservatives’ loyalty to Trump will affect their response to a policy they would have opposed under other circumstances.

The House’s foremost immigration hardliner, GOP Rep. Steve King of Iowa, made clear that he, for one, was not happy.

Reading this on your phone? Stay up to date with our free mobile app. Get it from the Apple app store or the Google Play store.

Addressing Trump over Twitter, King wrote that if the reports were true, “Trump base is blown up, destroyed, irreparable, and disillusioned beyond repair. No promise is credible.”

Earlier Wednesday, during a White House meeting with moderate House members from both parties, Trump had urged lawmakers to come up with a bipartisan solution for the “Dreamers.”

“We don’t want to forget DACA,” Trump told the members at the meeting. “We want to see if we can do something in a bipartisan fashion so that we can solve the DACA problem and other immigration problems.”

Foreshadowing what was to take place later that evening, Trump said he would be open to separating the wall issue from the question of the younger immigrants, as long as the wall got dealt with eventually.

At Thursday night’s dinner, “the president was clear he would press for the wall but separate from this agreement,” said Pelosi spokesman Drew Hammill.

The apparent deal is the latest example of Trump’s sudden pivot to bipartisanship after months of railing against Democrats as “obstructionist.” He has also urged them to join him in overhauling the nation’s tax code, among other priorities.

Trump, who was deeply disappointed by Republicans’ failure to make good on years of promises to repeal “Obamacare,” infuriated many in his party last week when he reached a three-month deal with Schumer and Pelosi to raise the debt ceiling, keep the government running and speed relief to states affected by recent hurricanes.

“More and more we’re trying to work things out together,” Trump explained Wednesday, calling the development a “positive thing” for both parties.

“If you look at some of the greatest legislation ever passed, it was done on a bipartisan manner. And so that’s what we’re going to give a shot,” he said.

The “Kumbaya” moment now appears to extend to the thorny issue of immigration, which has been vexing lawmakers for years. Funding for Trump’s promised wall had been thought to be a major point of contention between Republicans and Democrats as they attempted to forge a deal — yet by Thursday, Trump was apparently ready to deal even on that issue, the one that most defined his campaign for president last year.