He had served the State Department since 2002 , and had previously worked for the CIA for nearly three decades .