Talks between the US and the Taliban ended Monday without an agreement that would end America’s longest war as both sides said they would have to consult with leadership on the next steps.

The negotiations, held since last year in Qatar, sought a deal in which the US would withdraw its troops from Afghanistan in exchange for the Taliban guaranteeing they wouldn’t allow the country to once again become a base for Islamic militants.

The eighth round of talks that began on Aug. 3 was “productive,” said US envoy Zalmay Khalilzad, adding that he would return to Washington.

“We prolonged our meeting with the hope of reaching a peace agreement but it could not happen,” ​a member of the Taliban negotiating team told Reuters, asking to remain anonymous. “We discussed a number of issues and developed consensus on some of them but couldn’t reach a conclusion​.”

​Without an agreement from the Taliban, US officials believed removing the military presence would give the group free rein to try to overthrow the Afghan government.

​Even as talks were underway, the Taliban continued to carry out attacks across Afghanistan, targeting Afghan forces and government officials.

The US forced the Taliban out of power after it went to war in 2001 after al Qaeda leader Osama bin Laden attacked the US from his bunker in Afghanistan.

More than 2,400 US service members have died fighting in Afghanistan since.

​With Post wires​