Egypt has been trying to mediate between Hamas and Fatah .