WASHINGTON — President Trump, who on Twitter last year accused Pakistan’s leaders of “nothing but lies & deceit,” welcomed the country’s prime minister to the White House on Monday in an effort to mend relations and seek help in ending the war in neighboring Afghanistan.

Seated next to Prime Minister Imran Khan in the Oval Office, Mr. Trump gushed about the prospect of improved relations and trade with Pakistan and said he expected that Mr. Khan would help negotiate peace in Afghanistan so United States troops could come home.

“There is tremendous potential between our country and Pakistan,” Mr. Trump said during a 40-minute question-and-answer session with reporters from both countries. “I think Pakistan is going to help us out to extricate ourselves.”

Administration officials believe pressure from Pakistan could push the Taliban into a permanent cease-fire in Afghanistan, though they acknowledged that promises of such help from the Pakistani government had failed to materialize in the past.