Mr. Trump replied: “If you want to take it that further step, I’ll take the heat. I will take all the heat. You are not that far away from comprehensive immigration reform.”
Lawmakers from both parties were taken aback by the president’s words.
“My head is spinning with all the things that were said by the president and others in that room in the course of an hour and a half,” said Senator Richard J. Durbin, Democrat of Illinois, who has been leading the talks.
The president has been known to make conflicting or contradictory statements on complex policy issues, only to walk them back or change his mind. White House officials declined to provide specifics about what kind of immigration overhaul the president would favor, saying he was focused on the shorter-term measure that would shield undocumented immigrants brought to the country as children from deportation, in exchange for more border agents and a down payment on a border wall.
Hours after the meeting, Mr. Trump appeared to harden his insistence on the wall, writing on Twitter, “As I made very clear today, our country needs the security of the Wall on the Southern Border, which must be part of any DACA approval.”
And later on Tuesday, a federal judge in San Francisco ordered the Trump administration to reverse its move to end protections for undocumented immigrants brought to the country illegally as children, throwing the legal status of enrollees further into doubt and potentially complicating the politics of a legislative deal to permanently address their situation.
But the comments earlier Tuesday were a remarkable break with the divisive messaging that propelled Mr. Trump to the White House and the harsh policies that have defined his first year in office, marked by efforts to demonize and deport immigrants who have entered the country illegally.
The administration has also moved to curtail legal channels for immigration like refugee resettlement and temporary protections for vulnerable groups, including Salvadorans who have been allowed to live and work legally in the United States after earthquakes struck their country in 2001.
Instead, the president presented himself on Tuesday as a deal maker eager to find common ground and unconcerned with — if not blithely unaware of — the political perils of immigration debates. The phrase “comprehensive immigration reform” is detested by anti-immigration activists.
“I don’t think it’s going to be that complicated,” Mr. Trump told lawmakers assembled around his cabinet table of a broad immigration measure.
Republican senators were deeply skeptical.
“I don’t think comprehensive reform is as imminent as he would think it could be,” Senator Charles E. Grassley of Iowa said after returning from the White House.
Senator David Perdue, Republican of Georgia, cautioned against talk of a far-reaching deal. “I don’t like the word ‘comprehensive,’” he said. “That hasn’t worked as it relates to immigration.”
Mr. Trump’s call for a comprehensive solution came just after Mr. Graham had said he was a proponent of “a pathway to citizenship for 11 million people,” and then predicted “a drumbeat” of vitriol against such an approach. “Right-wing radio and talk show hosts are going to beat the crap out of us,” he said “It’s going to be ‘amnesty’ all over again.”
Mr. Trump seemed almost to relish such a fight.
“My whole life has been heat,” he shrugged. “I like heat, in a certain way.”
The White House meeting itself was extraordinary, an extended negotiating session that was broadcast by the news channels at a time when questions about Mr. Trump’s mental acuity and fitness for his job have been dominating the headlines.
The president appeared to signal a willingness to compromise with Democrats on the border security provisions that he says must be part of a near-term agreement to codify the protections created under DACA, or Deferred Action for Childhood Arrivals, the Obama-era program that he has moved to end by March that shields from deportation those brought to the United States illegally as children.
He called it a “bill of love,” echoing the language of Jeb Bush, one of his rivals for the Republican nomination in 2016 whom he once ridiculed. On Tuesday, Mr. Bush praised the president for seeking a bipartisan solution, while immigration hard-liners ridiculed Mr. Trump for sounding like the former Florida governor.
“Donald J. Trump,” read one slogan circulated by a prominent anti-immigration expert, Mark Krikorian, showing a scene from Tuesday’s meeting. “(The “J” is for ¡Jeb!)”