Without a Taliban commitment to power-sharing talks and a ceasefire, there are fears the insurgents will fight on when U.S. forces leave in a bid to overthrow the government

KABUL, Aug 12 (Reuters) - Talks on a pact that would allow the United States to end its longest war and withdraw troops from Afghanistan ended on Monday without agreement and both sides saying they would consult their leaders on the next steps.

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

But the United States is pushing for Taliban agreement on two other, more far-reaching elements: power-sharing talks with Afghanistan's U.S.-backed government and a ceasefire.

The eighth round of talks, which began on Aug. 3 and focused on technical details, ended in the early hours, according to Taliban spokesman Zabihullah Mujahid.

"We prolonged our meeting with the hope of reaching a peace agreement but it could not happen," said a member of the Taliban negotiating team in Qatar. "We discussed a number of issues and developed consensus on some of them but couldn't reach a conclusion," said the official, who declined to be identified.

The U.S. negotiators demanded that the Taliban announce a ceasefire and start direct talks with the Kabul government, the Taliban official said.

The Taliban, fighting since their own government was toppled in 2001 to expel foreign forces and establish an Islamic state, responded by calling for the United States to announce a roadmap for the withdrawal of their forces, he said.

The chief U.S. negotiator, veteran Afghan-American diplomat Zalmay Khalilzad, said this round of talks had been concluded and he was on his way back to Washington for consultations.

"They were productive," he said of the talks, in a post on Twitter.

Neither side said when the talks would resume.

An agreement would allow U.S. President Donald Trump to achieve his aim of ending a war launched in the days after the Sept. 11, 2001 al Qaeda attacks on the United States.

The war has become a stalemate, with neither side able to defeat the other and casualties rising among civilians as well as combatants as violence surges.

Without a Taliban commitment to power-sharing talks and a ceasefire, there are fears the insurgents will fight on when U.S. forces leave in a bid to overthrow the government.

The Afghan government has not been involved in the talks. The Taliban refuse to recognise or negotiate with it.

President Ashraf Ghani on Sunday appeared to question the talks, saying his nation would decide its future, not outsiders.

Ghani also told a gathering for prayers marking the Eid al-Adha Muslim festival that a presidential election, scheduled for Sept. 28, in which he hopes to win a second term is essential.

The Taliban have denounced the election as a sham and threatened to attack rallies. There has been speculation the vote could be postponed if the United States struck the deal with the militants, but Ghani said it was vital. (Reporting by Robert Birsel in KABUL and Jibran Ahmed in Peshawar Editing by Mark Heinrich)