In rugby football, the offside rule prohibits players from gaining an advantage from being too far forward. The specifics of the rule differ between the two major codes.
Rugby union
Offside laws in rugby union are complex. However the basic principle is simple: a player may not derive any advantage from being in front of the ball.
When the ball is carried by a single player in open play, any other player on the same team who is in front of the ball carrier is in an offside position. When the ball is in a ruck, maul, scrum or line-out, any player who is in front of the hindmost foot of the hindmost player of the same side in the ruck/maul/scrum/lineout is in an offside position. When the ball is in a scrum, the scrum-half must remain behind the ball and all other players not in the scrum must remain behind a line parallel to the goal-line and five metres behind the hindmost foot. A player in an offside position is forbidden from interfering with play in any way. In particular, a player in an offside position The opposing team may choose instead a scrum at the location where the offending team last played the ball.
