 After the formation of the Islamic Republic of Afghanistan in December 2004 , Saleh was appointed as head of the National Directorate of Security ( NDS ) by President Hamid Karzai . Saleh initiated structural reforms and helped rebuild the Afghan intelligence service . Saleh and former interior minister Hanif Atmar were viewed by the international community as two of the most competent cabinet members in the Afghan government . A western security expert told The Guardian that both men had a reputation for " clearing corruption within " their organs . 
