In Magic: The Gathering, an illegal action is an action that violates the rules of the game and/or requirements or restrictions created by effects.
From the Comprehensive Rules (Battlebond (June 8, 2018))
- 721. Handling Illegal Actions
- 721.1. If a player takes an illegal action or starts to take an action but can’t legally complete it, the entire action is reversed and any payments already made are canceled. No abilities trigger and no effects apply as a result of an undone action. If the action was casting a spell, the spell returns to the zone it came from. The player may also reverse any legal mana abilities activated while making the illegal play, unless mana from them or from any triggered mana abilities they triggered was spent on another mana ability that wasn’t reversed. Players may not reverse actions that moved cards to a library, moved cards from a library to any zone other than the stack, caused a library to be shuffled, or caused cards from a library to be revealed.
- 721.2. When reversing illegal spells and abilities, the player who had priority retains it and may take another action or pass. The player may redo the reversed action in a legal way or take any other action allowed by the rules.
From the glossary of the Comprehensive Rules (Battlebond (June 8, 2018))
- Illegal Action
- An action that violates the rules of the game and/or requirements or restrictions created by effects. See rule 721, “Handling Illegal Actions.”