KABUL, Afghanistan — Giving a first major public sign that they may be ready for formal talks with the American-led coalition in Afghanistan, the Taliban announced Tuesday that they had struck a deal to open a political office in Qatar that could allow for direct negotiations over the endgame in the Afghan war.

The step was a reversal of the Taliban’s longstanding public denials that they were involved in, or even willing to consider, talks related to their insurgency, and it had the potential to revive a reconciliation effort that stalled in September, with the assassination of the head of Afghanistan’s High Peace Council.

It was unclear, however, whether the Taliban were interested in working toward a comprehensive peace settlement or mainly in ensuring that NATO ends its operations in Afghanistan as scheduled in 2014, which would remove a major obstacle to the Taliban’s return to power in all or part of the country.

In a statement, Zabiullah Mujahid, a spokesman for the Taliban, said that along with a preliminary deal to set up the office in Qatar, the group was asking that Taliban detainees held at the American prison in Guantánamo Bay, Cuba, be released. Mr. Mujahid did not say when the Qatar office would be opened, or give specifics about the prisoners the Taliban wanted freed.