The ball in and out of play is the ninth law of the Laws of the Game of association football, and describes to the two basic states of play in the game.
The ball remains in play from the beginning of each period to the end of that period, except when:
The Law specifically notes that the ball remains in play if it rebounds off a goal frame, corner flag, referee or assistant referee, assuming that they are on the field of play at the time.
When the ball is in play players may play the ball, contest the ball, and goals may be scored. Players are liable to punishment for committing either fouls or misconduct. Substitutions may not occur whilst the ball is in play.
When the ball becomes out of play, the ball is put back into play be the appropriate restart. The restarts in football are:
Once the ball is out of play, the only restart is the restart appropriate for the reason the ball went out of play in the first place; subsequent actions do not change the restart. For example, if the ball goes out of play because of a foul by Team A against Team B, the restart must be a free kick to Team B even if a Team B player strikes an opponent; offending Team B player would, however, be liable for misconduct (i.e. yellow card or red card).
Note, however, that the referee may change the original restart if he realises he has made an error or on the advice of his assistant referees, provided play has not yet restarted. For example, if the ball has gone out of play because the ball was kicked into goal by Team A and the referee has signalled that a goal has been scored, but then notices that an assistant referee has indicated a foul by a Team A player immediately before the goal was scored, the referee would change to the correct restart of a free kick to Team B where the foul occurred.