Mr Mamdani has been a strong critic of Israel and its treatment of Palestinians throughout his public life.