Abdullah Abdullah, right, the chief executive of Afghanistan, talks with Gen. Raheel Sharif, Pakistan’s army chief, during a meeting in Kabul. Pakistan has said that the Taliban is willing to enter Afghanistan peace talks. (Hedayatullah Amid/European Pressphoto Agency)

Pakistani, Afghan and Western officials said Thursday that Afghanistan’s Taliban movement is ready to engage in peace talks with the Afghan government, which could open the door to a diplomatic solution to end the Islamist insurgency that has gripped the nation for more than 13 years.

The talks could start as early as next month, although it was unclear where they would be held, the officials said. But diplomats stressed that discussions on the terms of the talks were in their initial stages and that many obstacles lie in the way of achieving any significant results.

In a visit to Kabul this week, Gen. Raheel Sharif, Pakistan’s army chief, informed Afghan President Ashraf Ghani that the Taliban was amenable to peace talks, said a Pakistani diplomatic official who spoke on the condition of anonymity because he was not authorized to discuss the matter with the news media.

“However, this is the very initial phase, and it is yet to be decided when and where any such meeting between those two parties could be held,” the official said. “Afghan Taliban could meet representatives of the Afghan government next month, we believe.”

The Pakistani military said in a news release Thursday that Pakistan has “always supported” such a process and that any such endeavor should be “absolutely transparent, Afghan owned and Afghan led.”

According to local reports, four cities are being considered as possible venues for the negotiations: Kabul, Islamabad, Dubai and Beijing.

If the talks take place, they will represent the first direct negotiations between the Taliban and the Afghan government since the war began in late 2001, when U.S. airstrikes and Afghan resistance forces combined to drive the Taliban from power in Kabul after five years of rule.

Although previous attempts to hold peace talks have failed, the current political, diplomatic and security environment could offer the best opportunity for negotiations. Ghani’s predecessor, Hamid Karzai, remained deeply suspicious of Pakistan, but the new president has sought to improve ties with Islamabad, long a backer of the Taliban. China also has emerged as a key player, offering to broker talks.

Militarily, the insurgents are losing support within Pakistan, which launched a major offensive to flush out the militants from border areas. The war in Afghanistan is also in a stalemate, with the country’s security forces suffering huge losses and the Taliban unable to retake the capital and other major cities.

Still, many obstacles remain to holding the talks. It is not known whether the Taliban’s supreme leader, Mohammad Omar, has given his blessing for the negotiations. Omar has not been seen in public or heard from in years, and some analysts suspect that he may have died.

The Taliban is also a much altered movement these days, fragmented into factions, including ones that are even more radical. It is unclear whether the Taliban central command, based in the Pakistani city of Quetta, speaks for all the factions, some of which have proclaimed allegiance to al-Qaeda or the Islamic State.

Zabiullah Mujahid, a top Taliban spokesman, denied Thursday that the movement has agreed to the talks. “Afghanistan is still under occupation,” Mujahid said. “As we have always said, we won’t enter in any negotiations until the foreign occupiers leave Afghanistan.”

Diplomatically, it will be a touchy process. Afghanistan’s government has stressed that it wants complete ownership of the peace process, with no outside involvement, particularly from its Western backers.

On Thursday, reports emerged that U.S. officials were negotiating with Taliban leaders in Doha, Qatar, where the movement has an office. Within hours, the reports were furiously denied by both the Afghan government and the United States.

“We are not in direct talks with the Taliban, and there have not been any direct talks between the U.S. and the Taliban since January 2012, when the Taliban broke them off,” State Department spokeswoman Jen Psaki said. “The U.S. is committed to enabling progress on an Afghan-led and Afghan-owned reconciliation process which can lead to a stable and secure Afghanistan.”

Craig reported from Islamabad. Mohammad Sharif in Kabul and Karen DeYoung in Washington contributed to this report.