He previously served as special state department advisor for Iraq and as the deputy chief of mission in Baghdad .