But he said he is optimistic the insurgency in Afghanistan can be defeated .