By rule, this would be illegal. Rule 9-4-4, A player shall not kick a loose ball, a forward pass or a ball being held for a place kick by an opponent. However, Rule 2-15-1 states that "Kicking the ball is intentionally striking the ball with knee, lower leg or foot". Therefore, we'd need to use our judgement on whether this was or wasn't an intentional act before flagging.