Talks on a pact that would allow the United States to end its longest war and withdraw troops from Afghanistan have ended without agreement and both sides would consult their leaders on the next steps, the Taliban have said.

The talks, held in Qatar since late last year, have brought hopes for a deal allowing US troops to leave in exchange for a Taliban promise that Afghanistan will not be used by militants as a base from which to plot attacks abroad.

But the US is pushing for Taliban agreement on two other elements: power-sharing talks with the US-backed government and a ceasefire.

Taliban spokesman Zabihullah Mujahid said the eighth round of talks, which a US official said earlier involved technical details of the implementation of the pact, ended in the early hours and both sides would consult their leaders.

US has been negotiating a pact that would see the withdrawal of 14,000 troops from Afghanistan

According to Zabihullah Mujahid said the talks, which had been taking place in Doha, finished after midnight.

"Work was tedious & effective. Both sides agreed to consult their respective leaderships for next steps," he wrote on Twitter.

There was no immediate comment from the US embassy in Kabul.

Yesterday, US peace envoy Zalmay Khalilzad tweeted: "I hope this is the last Eid where Afghanistan is at war," referring to the Eid al-Adha festival currently taking place in the Muslim world.

Speculation has reached fever pitch in Kabul in recent days that an announcement about a US-Taliban deal may be imminent.

The US has been negotiating with its longtime foe over the past year for a pact that would see the Pentagon begin to withdraw its 14,000 troops from Afghanistan.

Read more:

The US is keen to end its 18-year involvement in Afghanistan, where it has spent more than $1tn, and President Donald Trump has said he wants troops return home.

In return, the Taliban would commit to various security guarantees, including that the Islamist hardliners who long harboured Al-Qaeda would not allow Afghanistan to become a jihadist safe haven.

A US-Taliban agreement would not in itself bring Afghanistan's war to an end, as the insurgents would still need to make a deal with the Kabul government.

Many Afghans had been hoping for a ceasefire to be announced over Eid. This has not happened, but recent days have been relatively calm.

Today, Afghanistan's intelligence service announced 35 Taliban prisoners would be released "as a gesture of goodwill".

"The release of these prisoners is a clear sign of the strong will of the government for peace and end to war," the agency said in a statement.

The Taliban and Afghan security forces periodically release enemy prisoners.