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.

John F. Kelly, the retired Marine general credited with bringing a measure of discipline to Mr. Trump’s chaotic White House during his six months as chief of staff, told members of the Congressional Hispanic Caucus that he had educated the president about the issue of immigration, adding that Mr. Trump had “evolved” on the wall.

But President Trump directly contradicted the chief of staff on Thursday, saying his position on building the wall had not “evolved.”

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