Pakistani security officials said on Saturday that Muhammad Umar, a close aide of the former Taliban governor of Kandahar province, was detained near the southwestern border town of Chaman.
"Initially he was detained on the charge of crossing the border without proper travel documents," an official said.
"But during the investigation we found that the detained person is an important Taliban commander and he was very close to the former Kandahar governor, Mullah Muhammad Hasan Rehmani," he added.
Umar's chance detention is good news for the Afghan authorities.
Spiralling attacks on US-led forces and their pro-government allies in Afghanistan in recent months have been blamed on the regrouping Taliban.
Some Afghan officials say Taliban fighters seek safe haven in neighbouring Pakistan by stealthily crossing over the porous border. Pakistan says it is doing all it can to stop the fighters from crossing over.
Since withdrawing support to the Taliban in 2001, Pakistan has rounded up hundreds of Taliban suspects. Many of them have been handed over to the US authorities.