THE DECISION
The referee cannot apply the advantage because the attacker who gained the ball was offside when it was kicked. Therefore, the referee stops play, awards a direct free kick for the foul (as it occurred before the offside offence), and cautions (yellow card) the defender for unsporting behaviour (SPA offence).
Read official Law 11 ↗