Palestinian group Hamas on Monday agreed to a ceasefire proposal in the seven-month-old war with Israel in Gaza, hours after the Israeli military told residents to evacuate some parts of Rafah, which has been sheltering more than a million displaced people.