WASHINGTON — President Trump’s chief of staff privately told a group of Democratic lawmakers on Wednesday that Mr. Trump had not been “fully informed” when promising voters a wall along the Mexican border last year, and said that he had persuaded the president it was not necessary. He also expressed optimism that a bipartisan immigration deal could eventually be reached.

In an early-morning Twitter post, Mr. Trump said, “The Wall is the Wall, it has never changed or evolved from the first day I conceived of it.” He added in a second tweet, “The Wall will be paid for, directly or indirectly, or through longer term reimbursement, by Mexico, which has a ridiculous $71 billion dollar trade surplus with the U.S.”

The comments Mr. Kelly made Wednesday were an unusual instance of a White House chief of staff seeming to undercut public statements made by the president, in the process contradicting the central message of “Build the wall” that defined Mr. Trump’s presidential campaign. The president has recently begun to temper his own statements about the wall, telling a group of Republican and Democratic lawmakers at the White House last week that a 2,000-mile structure would not be needed because parts of the border would be impassable.

But in telling lawmakers that Mr. Trump had essentially erred from the start in promoting a wall and by claiming credit for dissuading him, Mr. Kelly appeared to be voicing a sentiment some in the West Wing have heard him express privately — that it is his job to tutor a sometimes ill-informed president who has never served in public office before.

At the same time, it suggested that Mr. Kelly, who served as secretary of homeland security before coming to the White House and has hard-line views on immigration that mirror the president’s restrictionist approach, was positioning himself now as a moderating influence.

Mr. Kelly made the remarks at a meeting with members of the Hispanic Caucus, as a group known as the Twos — the No. 2 Democrat and Republican in both the House and Senate — worked toward negotiating a deal to protect from deportation the young undocumented immigrants known as Dreamers. The meeting with the Hispanic caucus was first reported by The Washington Post.

Mr. Kelly expressed confidence that the negotiations to preserve the protections provided by the Deferred Action for Childhood Arrivals program, or DACA, the Obama-era policy that Mr. Trump moved in September to end, would succeed, though not necessarily this week. The president gave Congress six months to enact a replacement for the program, which protects about 780,000 young people.

“There’s no doubt in my mind there’s going to be a deal, so long as men and women on both sides are willing to talk,” Mr. Kelly said in an interview with Fox News.

As recently as Sunday, Mr. Trump was far more pessimistic about the program’s future and criticized its Democratic supporters. “DACA is probably dead because the Democrats don’t really want it, they just want to talk and take desperately needed money away from our Military,” he wrote on Twitter.

Mr. Kelly told lawmakers that “he was the one who tempered” Mr. Trump “on the issue of the wall, on the issue of DACA,” said Representative Raúl Grijalva, Democrat of Arizona, who attended the session.

Representative Luis V. Gutiérrez, Democrat of Illinois, who was also at the meeting, quoted Mr. Kelly as having told the group that, “a 50-foot wall from sea to shining sea isn’t what we’re going to build.”

Mr. Gutiérrez told reporters that at the meeting, Mr. Kelly said that during the presidential campaign, “there were statements made about the wall that were not informed statements.”

Mr. Trump often cited his promise to build a “big, beautiful wall” to energize his campaign rallies.

Marc T. Short, the White House director of legislative affairs, denied the Democrats’ characterization of Mr. Kelly’s comments about the president’s familiarity with immigration issues, telling CNN in an interview: “I don’t recall General Kelly saying the president was uninformed.”

But he did not dispute the notion that the president has changed his view of what is needed to secure the border, based in part on information from Customs and Border Protection, the government agency charged with immigration enforcement.

The wall has been a prominent issue in the negotiations over DACA, with Mr. Trump insisting that funding to build it be part of any such bill, along with measures to limit the extended family members immigrants can sponsor for entry into the United States and an end to the diversity visa lottery.

As Mr. Trump’s first secretary of homeland security, Mr. Kelly presided over the beginnings of the president’s immigration crackdown, including the enactment of his travel ban and tougher interior enforcement measures.

But Mr. Kelly did not push the idea of a solid wall across the entire southern border, arguing from the outset that “a physical barrier will not do the job.” More recently, he has prevailed upon Mr. Trump not to dwell on the idea of Mexico paying for the wall, a notion that the president has not mentioned for some time.

“He used the word ‘evolved,’” Mr. Grijalva said, adding that Mr. Kelly said Mr. Trump has “evolved, in the general context of the wall and DACA, and he said you make campaign promises; that’s different from governing.”

Two House Democratic aides who attended the meeting confirmed the accounts given by Mr. Grijalva and Mr. Gutiérrez.

Representative Lucille Roybal-Allard, Democrat of California, said she sought a clarification from Mr. Kelly about what would constitute the border wall that Mr. Trump is seeking, since “so many people have different ideas about what the wall actually is.”

Mr. Kelly said that since taking office, Mr. Trump “realizes what the realities are, and that they are no longer considering the wall to be what was described in the campaign,” Ms. Roybal-Allard said.

“It wasn’t until he got to the White House that he was better informed in terms of what were the possibilities in terms of barriers,” Ms. Roybal-Allard added, recalling what Mr. Kelly said about Mr. Trump.

Emily Baumgaertner contributed reporting.

A version of this article appears in print on , on Page A1 of the New York edition with the headline: Trump Was Not ‘Fully Informed’ In 2016 Vow on Wall, Kelly Says. Order Reprints | Today’s Paper | Subscribe