How did I get stalemated here!?!?

Sort:
Mandiblez

I'm black. We were even most of the game, he only moved his king like 6 times, I just started getting the upper hand and right when I captured his pawn on A4 it suddenly said draw by stalemate.

lostpawn247

Like post #2 said, any king moves to the g-file (Kg6 or Kg5) are guarded by the g2 rook. Kh6 is illegal because the blacks g7 pawn guards that square. Whites h4 pawn can't move because it's progress is stopped by the white king. With the exception of whites a-pawn, you had white's king trapped in a mating net (a position where the king had no legal moves) and could have delivered checkmate if you could get a piece (Like the c3 knight) to deliver a check. Instead of 39...bxa4?? (Creating the stalemate), you leave the pawn on the board and play 39...Nd5!(Ne2!) 40.a5(axb5) Nf4#