There are some defensive ideas to get one's own king stalemated in order to not lose the game (mostly in the endgame, but sometimes also in the middle game).
- Have (master) games been played where the only idea not to lose was to stalemate the opponent?
- What about any legal position (which need not have occurred in a real game)?
- What if you forget about the "only idea" requirement?
Edit: Although there is already a totally fine answer, I would not mind more answers using another patterns.