The Afghan intelligence, national directorate of security (NDS), said the man was detained during an operation from Kabul city.
A statement by NDS said the detained suspect has been identified as Allah Noor who is originally a resident of Quetta city of Pakistan.
The detained agent confesses in a video published by NDS saying he wanted to have a role in the attack on Pul-e-Charkhi prison.
He also admits his involvement in organizing meetings between the ISI officials and Taliban leader Mullah Hebatullah as well as Haqqani network leader Sirajuddin Haqqani network in Pakistan.
Allah Noor says he started operations with the ISI in 2013 and had visited Kabul to gather information for the future plans apart from hatching plans for the attack on Pul-e-Charkhi prison.
The Afghan officials have long been insisting that the leadership councils of the Taliban group and the notorious Haqqani terrorist network are based in Peshawar, Quetta, and other parts of Pakistan from where they plan and coordinate attacks in Afghanistan with the support of certain government circles in Pakistan.