Well of course it is illegal.
"...“If this is not apartheid, what is?” Palestine tells top UN court Israel’s occupation is illegal
Twenty years after the International Court of Justice issued an Advisory Opinion on Israel’s Separation Wall, the ICJ is now considering the legality of Israel’s 56-year belligerent occupation of the Palestinian territories..."