The book 'Directorate S' by Steve Coll, an investigative journalist is worthwhile reading.
Directorate S is a highly secretive arm of the Pakistan state, which has been covertly training and arming the Taliban for years as part of wider competition for global influence.
If anyone has recently been watching Al Jazzera news, it mentions that Qatar is acting as facilitator and supplying an office for the Talban negotiators with the US for a political solution to Afghanistan
These then secret negotiations were supposed to have happened a number of years ago but stalled because of other parties pressures and subversiveness.