The mass demonstration pushed Spain to hand over control of the disputed territory, paving the way for Morocco’s takeover.