Why Hamas agreed to give up its hostages