If the flagstick is not attended, removed or held up before the player makes a stroke, it must not be attended, removed or held up during the stroke or while the player's ball is in motion if doing so might influence the movement of the ball.
Note 1: If the flagstick is in the hole and anyone stands near it while a stroke is being made, he is deemed to be attending the flagstick.
Note 2: If, prior to the stroke, the flagstick is attended, removed or held up by anyone with the player’s knowledge and he makes no objection, the player is deemed to have authorized it.
Note 3: If anyone attends or holds up the flagstick while a stroke is being made, he is deemed to be attending the flagstick until the ball comes to rest.
(Moving attended, removed or held-up flagstick while ball in motion – see Rule 24-1)
17-2. Unauthorized Attendance
If an opponent or his caddie in match play or a fellow-competitor or his caddie in stroke play, without the player's authority or prior knowledge, attends, removes or holds up the flagstick during the stroke or while the ball is in motion, and the act might influence the movement of the ball, the opponent or fellow-competitor incurs the applicable penalty.
*PENALTY FOR BREACH OF RULE 17-1 or 17-2:
Match play – Loss of hole; Stroke play – Two strokes.
*In stroke play, if a breach of Rule 17-2 occurs and the competitor’s ball subsequently strikes the flagstick, the person attending or holding it or anything carried by him, the competitor incurs no penalty. The ball is played as it lies, except that if the stroke was made on the putting green, the stroke is canceled and the ball must be replaced and replayed.
17-3. Ball Striking Flagstick or Attendant
The player’s ball must not strike:
a. The flagstick when it is attended, removed or held up;
b. The person attending or holding up the flagstick or anything carried by him; or
c. The flagstick in the hole, unattended, when the stroke has been made on the putting green.
Exception: When the flagstick is attended, removed or held up without the player’s authority – see Rule 17-2.
PENALTY FOR BREACH OF RULE 17-3:
Match play – Loss of hole; Stroke play – Two strokes and the ball must be played as it lies.
17-4. Ball Resting Against Flagstick
When a player’s ball rests against the flagstick in the hole and the ball is not holed, the player or another person authorized by him may move or remove the flagstick, and if the ball falls into the hole, the player is deemed to have holed out with his last stroke; otherwise, the ball, if moved, must be placed on the lip of the hole, without penalty.
©USGA, used with permission