How Hamas won and kept control in Gaza