In the interim , Ghailani was captured in Pakistan in 2004 and held in a secret CIA prison overseas for two years before being transferred to Guantanamo , one of about a dozen " high value detainees , " with alleged al-Qaeda ties , sent there when the Bush administration emptied the intelligence agency 's " black site " prisons .