Israel and Palestinian militants agree to ceasefire after worse Gaza violence since 2014