“The president has been very clear in his process that the immigration system is broken and needs massive reform, and he’s made clear that he’s open to having conversations about that moving forward,” Ms. Sanders said. “Right now, his primary focus, as he has made over and over again, is border control and security at the border and deporting criminals from our country, and keeping our country safe, and those priorities have not changed.”

The president’s remarks about immigration came as he prepares to issue a new version of his executive order banning travel to the United States from seven predominantly Muslim countries and suspending the acceptance of refugees. The ban has been revised because of legal challenges.

Mr. Trump defended that order in his address to Congress.

“It is not compassionate, but reckless, to allow uncontrolled entry from places where proper vetting cannot occur,” Mr. Trump said. “Those given the high honor of admission to the United States should support this country and love its people and its values. We cannot allow a beachhead of terrorism to form inside America — we cannot allow our nation to become a sanctuary for extremists.”

The speech reflected the war Mr. Trump is fighting with himself and his inner circle. Even as he held out the possibility of legal status for millions of undocumented immigrants, Melania Trump, the first lady, was hosting the families of victims of violent crime by such immigrants — a way of highlighting the president’s belief that immigrants who lack legal status pose a grave threat to Americans and should be feared and removed, not embraced.

Mr. Trump singled out the victims’ families, saying, “Your loved ones will never be forgotten.”

Giving the official Democratic response, former Gov. Steven L. Beshear of Kentucky offered an implicit contrast to the president by noting his own humble background and military service, accusing Mr. Trump and his “cabinet of billionaires and Wall Street insiders” of favoring banks and the wealthy over ordinary people.

“You and your Republican allies in Congress seem determined to rip affordable health care away from millions of people who most need it,” Mr. Beshear said. “This isn’t a game. It’s life and death for people.”

For Mr. Trump’s speech, the president turned to the top advisers who helped develop his inaugural address: Stephen Miller, his senior policy adviser, and Stephen K. Bannon, his chief strategist. The two were still working on the speech late Monday, aides said.

Mr. Miller and Mr. Bannon, both architects of the president’s tough immigration policies, were responsible for shaping the dark themes of the president’s speech on Inauguration Day.