President Trump meets with a bipartisan group of members of Congress, including Reps. Josh Gottheimer and Tom Reed, at the White House Wednesday. (Jonathan Ernst/Reuters)

President Trump on Wednesday vowed not to cut taxes for the wealthy, extolled the virtues of bipartisanship as leading to “some of the greatest legislation ever passed” and then — in a surprise move announced deep into the night — agreed to cut a deal with Democrats saving hundreds of thousands of illegal immigrants from deportation.

That Trump did all of that while declaring himself “a conservative” only heightened the sense of surrealism that has wafted through the nation’s capital over the past eight days, as the president has expressed a newfound, if tentative, willingness to work across the aisle — a development that has left many Republicans chagrined and some Democrats cautiously optimistic.

Trump’s outreach suggested that an unexpected deal he reached last week with Democrats may not have been an aberration. This week’s effort began Tuesday at a bipartisan White House dinner with senators and proceeded to a gathering of House Democrats and Republicans on Wednesday afternoon.

It was finally capped off Wednesday night by a presidential meal with the nation’s two top Democrats, Senate Minority Leader Charles E. Schumer (N.Y.) and House Minority Leader Nancy Pelosi (Calif.), during which they reached the contours of an immigration deal and discussed Beijing trade issues over a menu of Chinese cuisine.

Calling the dinner “very productive,” Schumer and Pelosi said in a statement late Wednesday that Trump had agreed to “enshrine the protections” of a Barack Obama-era executive order into law “quickly,” protecting about 700,000 illegal immigrants who were brought to the United States as children. They would also “work out a package of border security, excluding the wall, that’s acceptable to both sides,” the statement said.

In a separate statement, the White House said the gathering was “constructive” and that it focused on immigration, infrastructure and trade.

“Bottom line: There really is a new strategy coming out of the White House,” said Rep. Henry Cuellar, a moderate Texas Democrat who had turned down previous White House invites but decided to attend Wednesday’s afternoon session. “He meets with the bipartisan senators last night. He meets with us. He meets with Pelosi and Schumer today. There is a new strategy in place.”

Rep. Tom Reed (R-N.Y.), a Trump supporter who also attended the afternoon gathering, said the president “has seen the theater up here and learned the lesson: Extremes on both the right and left are problematic to getting his agenda accomplished. You can’t run a partisan bill to the finish line, so he knows he has to have his Plan B ready.”

After eight months of pursuing a mostly hard-right, pro-Republican agenda with limited success, Trump is flirting with fulfilling his campaign promises to govern as a bipartisan dealmaker — including the possibility of legalizing thousands of undocumented immigrants after running stridently against the idea as a candidate. Trump could also be signaling the return of a recently bygone era when lawmakers of both parties dining — and working — with the president was hardly abnormal.

But, then, these are not normal times.

“It’s up is down and down is up,” said Jim Manley, a Democrat and former longtime Senate aide. “No doubt about it.”

Last Wednesday, Trump shocked and angered Republican leaders by agreeing with Schumer and Pelosi to provide Hurricane Harvey relief while raising the federal borrowing limit and funding the government through December.

Then came Tuesday’s bipartisan dinner for senators, which included talk of infrastructure projects and featured three Democrats up for reelection in 2018 in states that Trump carried: Sens. Joe Donnelly (Ind.), Heidi Heitkamp (N.D.) and Joe Manchin III (W.Va.).

After the afternoon meeting, several House Democrats expressed hope that they can work with the president.

“He was very explicit in saying that there would be no tax cut in this package for the wealthy,” said Rep. Peter Welch (D-Vt.), referring to a pledge by Trump on Wednesday that would mark a notable departure from his previous proposals. “At one point, he said they may have to pay a little more.”

Still, Trump has done little to reach out to Democrats until the past week and has often openly derided them and Obama. Trump has begun dismantling Obama-era regulations and protections on issues including health care, labor and the environment. Last week, he also rescinded protections for 700,000 young undocumented immigrants brought to the United States as children and known as “dreamers” — the same group he now says he wants to protect.

Even on Wednesday, as the president played host to two bipartisan meetings, Trump and his team continued to equivocate. He expressed support for another Republican health-care plan — spearheaded by Sens. Bill Cassidy (R-La.) and Lindsey O. Graham (R-S.C.) — aimed at sharply curtailing Medicaid and other parts of the Affordable Care Act, commonly called Obamacare. In her daily press briefing, White House press secretary Sarah Huckabee Sanders argued that Trump is always working on behalf of Republicans.

"The president is the leader of the Republican Party and was elected by Republicans," Sanders said. "He beat out 16 other candidates to take that mantle on. And certainly I think one of the strongest voices. And so the idea that the Republican Party ideas are not represented in that room is just ridiculous."

Trump's reasons for engaging with lawmakers beyond the Republican leadership is deeply shaped by his experience on health-care legislation, which has so far stalled in the Senate after months of fits and starts, according to two people familiar with the issue who have spoken with him recently. Trump remains unhappy with GOP leaders for promising success earlier in the year, only to see the effort fall apart, said the people, who insisted on the condition of anonymity to speak candidly.

Trump now believes that Republicans — who control both the House and the Senate — cannot be trusted to carry bills to passage by themselves and views it as his burden to create a better environment for his legislative agenda to garner support. What matters to him, one Republican lawmaker said, is “putting wins on the board — not the specifics.”

Instead of relentlessly courting members of the conservative, and often intractable, House Freedom Caucus, as he did on health care, Trump wants them to “feel the burn a little bit,” the lawmaker added, framing the new outreach as Trump’s way of reminding conservatives in both chambers that he likes them but does not need them.

“They’re not the only player he’s willing to play with,” said Michael Steele, the former Republican National Committee chairman. “He’s saying to them, ‘I’ll be a free-range president.’ ”

Sen. Ron Johnson (R-Wis.), who attended Tuesday's dinner, said jump-starting talks on tax cuts and other potential changes remains at the top of Trump's agenda. He said Trump wants to focus cuts on brackets that affect middle-class people.

"Let's face it: If you want tax reform, you want to avoid pitfalls that make it impossible," Johnson said of Trump's approach on this priority. "Selling tax cuts for the wealthy is pretty impossible."

"What I saw from the president was a genuine process to find bipartisan agreement on taxes and infrastructure," Johnson added. "My guess is some Democrats definitely agree with him."

Manchin said the Tuesday dinner was “a very good, productive meeting” and said he believes the president, who was once a registered Democrat, is simply entering his legislative comfort zone.

“The president seemed more at ease, more comfortable, talking about finding a bipartisan solution than trying to have to defend a rigid, one-side-only works,” Manchin said. “I think he’s able to approach legislation in a total sphere, not just one side.”

Moderate Republicans, in particular, have cheered this development, after long feeling sidelined inside the House as Freedom Caucus members and other conservatives have rebelled against their party’s leadership.

Trump's conservative critics, however, said his latest gestures reflect his liberal instincts on some issues and his intense desire for popularity.

"He's always had that itch to liberate himself from the Republican Party," said William Kristol, a Trump critic and editor at large of the Weekly Standard magazine. "He ran against it in 2015 and 2016, and has attacked it in 2017. He wants to win and doesn't care about the substance of winning."

Kristol added, "Democratic voters may loathe Trump, but he could conceivably give them lots of policy victories."

Democrats say they are focused only on working with the president on areas where they believe they can get what they want in terms of their priorities, including protections for the dreamers and federal health-care subsidies for Obamacare. They have vowed not to trade dreamer protections for Trump’s long-promised wall at the southern border — and in recent days the White House has indicated the two issues do not have to be linked.

On other issues and with this president, many Democrats remain wary.

Donnelly, despite being wooed by Trump and up for reelection next year, said he feels no pressure to vote for the Republican tax plan if he thinks it’s a bad deal.

“If the tax package makes sense, I’ll support,” Donnelly said. “If not, I’ll pass.”

The halting forays into bipartisanship have proved a new experience for many. At Tuesday’s dinner, Manchin was presented with yet another surprise in a week full of them: an apple strudel topped with what looked to be a delicate white egg.

“I’m thinking, ‘Boy, what do I do with this?’ ” Manchin said. “But I’m thinking, ‘When in Rome,’ so I take a bite, and, lo and behold, it’s ice cream.”

Such is the dilemma facing Democrats in this moment of Trumpian outreach: The perks are enticing, but they are not entirely sure what they’re dipping their spoon into.

Donnelly, however, said he had no doubt. “I knew it was ice cream from the start,” he said.

Mike DeBonis, Ed O’Keefe and David Nakamura contributed to this report.