WASHINGTON — President Trump on Tuesday appeared open to negotiating a sweeping immigration deal that would eventually grant millions of undocumented immigrants a pathway to citizenship, declaring that he was willing to “take the heat” politically for an approach that seemed to flatly contradict the anti-immigration stance that charged his political rise.

The president made the remarks during an extended meeting with congressional Republicans and Democrats who are weighing a shorter-term agreement that would extend legal status for undocumented immigrants brought to the United States as children. The 90-minute session — more than half of which played out on national television — appeared to produce some progress: Mr. Trump agreed to a framework for a short-term immigration deal to couple protection for young, undocumented immigrants with border security.

But in suggesting that a broader immigration measure was possible next, Mr. Trump was giving a rare public glimpse of an impulse he has expressed privately to advisers and lawmakers — the desire to preside over a more far-reaching solution to the status of the 11 million undocumented immigrants already living and working in the United States. Passage of a comprehensive immigration law would give Mr. Trump success where Presidents Barack Obama and George W. Bush failed.

The push for an immigration deal with Democrats has the potential to alienate the hard-line anti-immigration activists who powered his political rise and helped him win the presidency, many of whom have described it as amnesty for lawbreakers. If he succeeds, it could be compared to Richard Nixon’s historic trip to China. Only an anti-Communist hard-liner could have made the opening acceptable to his supporters.

If he fails, it would be more like Ronald Reagan in Reykjavik, Iceland, where he suggested eliminating much of the United States and Soviet nuclear arsenal, a momentary glimmer of idealism that was crushed by a backlash from his own party.Continue reading the main story

Senator Lindsey Graham, Republican of South Carolina, floated the idea of a broader immigration deal during the meeting in the White House Cabinet Room on Tuesday, making clear that it would have to include a pathway to citizenship for undocumented immigrants already in the country.

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.”

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.”