Offside is one of the laws of association football, codified in Law 11 of the Laws of the Game. The law states that players in an offside position, when the ball is touched or played by a teammate, may not become actively involved in the play. A player is in an offside position if any of their body parts with which they can touch the ball during any other part of the play is in the opponents' half of the pitch and closer to the opponents' goal line than both the ball and the second-to-last opponent (usually, but not necessarily always, the last defensive player in front of the goalkeeper). Being in an offside position is not an offence in itself; at the moment the ball touches, or is played by, the player's team, the player must also be "actively involved in the play" in the opinion of the referee, in order for an offence to occur. When the offside offence occurs, the referee stops play and awards an indirect free kick to the defending team from the position of the offending player.
The offside offence is neither a foul nor a misconduct, players are never booked or sent off for offside. Like fouls, however, any play (such as the scoring of a goal) that occurs after an offence has taken place but before the referee is able to stop the play is nullified. Players that continue such play may be booked based on the referee's assessment of how significant or intentional the play was.
One of the main duties of the assistant referees is to assist the referee in adjudicating offside — their position on the sidelines giving a more useful view sideways across the pitch. Assistant referees communicate that an offside offence has occurred by raising a signal flag. However, as with all officiating decisions in the game, adjudicating offside is ultimately up to the referee, who can overrule the advice of their assistants if they see fit.