how was his participation illegal?
He is standing in the opponent's side of the ruck whilst not bound, so he's offside ahead of his own team's HMF.
[LAWS]General Definitions
Binding: Grasping firmly another player’s body between the shoulders and the hips with
the whole arm in contact from hand to shoulder.[/LAWS]
[LAWS]16.2 (b) A player joining a ruck must bind on a team-mate or an opponent, using the whole arm. The
bind must either precede, or be simultaneous with, contact with any other part of the body
of the player joining the ruck.
Sanction: Penalty kick
16.2 (c)
Placing a hand on another player in the ruck does not constitute binding.
Sanction: Penalty kick[/LAWS]