This whole scenario requires the use of Laws 10.1, 10.4 and 10.5 - 10.1 to define whether the player is offside, 10.4 to determine if the player should be penalised and what the sanction is and 10.5 to be used as a reason why 10.4 can occur but you don't need a penalty? If we look just at one of them I don't think we get the complete picture of how these laws should be used.