The world’s top court ruled that Israel’s presence in the occupied Palestinian territories is unlawful and must end “as rapidly as possible.”