Maher served as Egypt 's top diplomat from 2001 until 2004 .