He was in an offside position when the ball was played forwards. But it appears that it came off a defender who was deliberately trying to play the ball, which now means he is on. Wierd rule.