President Trump’s confident assertion that the Taliban is ready and even eager for a cease-fire demanded by the United States in Afghanistan’s 18-year-old war may be more wishful thinking than reality.

Declaring that the U.S.-Taliban talks he abruptly canceled in September are back in motion, Trump said during a Thanksgiving Day visit to troops in Afghanistan that the Taliban “wants to make a deal. And we’re meeting with them, and we’re saying it has to be a cease-fire.”

“They didn’t want to do a cease-fire, but now they do want to do a cease-fire,” Trump said of the militants. “It will probably work out that way. . . . We’ve made tremendous progress,” he added.

But on Friday neither the Taliban nor the government of Afghan President Ashraf Ghani indicated that a cease-fire was near, or even being discussed in resumed U.S. negotiations.

At the time the U.S.-Taliban talks ended, the two sides were preparing to sign a draft agreement that called for a reduction in violence. But it specifically declared that any discussion of a cease-fire was to be left to follow-on negotiations between the militants and the government in Kabul.

In a statement, the Taliban said that remains its understanding. “We are ready to talk, but we have the same stance to resume the talks from where it was suspended,” Taliban spokesman Zabiullah Mujahid told The Post.

Ghani spokesman Sediq Seddiqi said Trump’s brief visit to Afghanistan was “important” but that “we will have to see” whether there has been any change in the status of peace talks.

“It is too early to comment on any changes or any perceived changes,” Seddiqi said.

Even the administration voiced a lower expectation than Trump.

“As the president said, we are restarting talks with the Taliban. The focus will be on reducing violence,” said a senior administration official, who like others discussed the closed-door talks on the condition of anonymity. “If an agreement can be reached, the two sides could potentially expand the talks and pave the way for signing a peace agreement.”

After nearly a year of U.S.-Taliban negotiations, held in the Qatari capital of Doha and led on the U.S. side by special envoy Zalmay Khalilzad, the parties reached a four-part agreement that included a partial withdrawal of U.S. troops and a Taliban pledge to sever relations with al-Qaeda and to ensure that none of the territory it controls — now more than 50 percent of Afghanistan — would be used for terrorist activities directed at the United States or its allies.

The Taliban also committed to beginning direct talks with the Afghan government, with a cease-fire at the top of the agenda.

But after secretly planning a meeting with Taliban negotiators at Camp David to seal the deal, Trump suddenly canceled the agreement and negotiations altogether, saying that “as far as I’m concerned, they’re dead.”

Trump said at the time that he had called off the talks after the Taliban took responsibility for an attack that killed 12 people, including a U.S. service member. “What kind of people would kill so many in order to seemingly strengthen their bargaining position?” Trump said in a tweet.

The announcement threw into doubt Trump’s hopes of drawing down the number of troops in Afghanistan, a pledge made during his 2016 campaign. Despite his claim that he was responding to a U.S. service member’s death, the move also reflected divisions inside the administration between Khalilzad’s boss, Secretary of State Mike Pompeo, and then-national security adviser John Bolton, who opposed the negotiations.

The Taliban said it would be willing to continue talking, even as Afghanistan headed toward a heavily contested presidential election that Ghani hoped would strengthen his hand in direct government talks with the militants.

Barred from formally restarting the discussion, Khalilzad has conducted low-profile consultations with Afghanistan and regional governments, and in recent days began informal conversations with the Taliban.

Although the election took place in late September, no winner has been declared amid charges of widespread irregularities at the polls. Earlier this month, Ghani agreed to release three Taliban prisoners in exchange for two hostages — an American and an Australian, both professors at the University of Kabul — held by the Taliban for the past three years.

At the same time, the United States has moved forward with planning the same withdrawal — a reduction to 8,600 troops from about 13,000 deployed there now — that was envisioned as part of the original deal.

“We’re bringing it down very substantially,” Trump said Thursday of the U.S. force. “And we’re going to stay until such time as we have a deal or we have total victory.”

After the talks ended, despite a slight reduction in violence with the Taliban, the militants have remained ascendant. But Trump said that over the past few months “we’ve hit them so hard, they’ve never been hit this hard. In the history of the war, they have never been hit this hard.” That, he indicated, is why “they want to make a deal.”

But analysts said the main Taliban goal remains the withdrawal of all foreign forces in Afghanistan, and it has little impetus now to stop fighting.

“To date, they’ve very strongly resisted” a cease-fire, “and it’s their best leverage,” said one person familiar with the negotiations. “They have no reason to trade that chit in now, especially at a time where U.S. leverage is a wasting asset, and they believe they’re winning on the battlefield. And Trump has committed to a drawdown of forces regardless, so why would the Taliban offer up a cease-fire now?”

In his remarks to the troops Thursday, Trump appeared to conflate the Islamic State and al-Qaeda, both of which have a presence in Afghanistan, although they compete for followers and do not cooperate with each other.

A June Defense Department report put the number of Islamic State fighters at about 2,000, located in Konar and Nangahar provinces along the Pakistani border. A relatively small al-Qaeda presence, it said, “poses a very limited threat to U.S. personnel and our partners in Afghanistan.”

Afghan forces, with close American support, scored a major victory earlier this month when they retook a cluster of villages in Nangahar province, leading to the surrender of hundreds of Islamic State fighters.

Trump said there had been “tremendous progress . . . with respect to ISIS and al-Qaeda. And we’ve hit them very, very hard. . . . They had many thousands a short while ago, and now they’re down to hundreds. Probably 200 left.”

George reported from Kabul. Haq Nawaz Khan in Peshawar, Pakistan, contributed to this report.