Hypersmurf
Moderatarrrrh...
This rule is clearly intended to be used for ending a characters movement when extraordinary circumstances regarding creatures occupying a square arise.
If you move consecutively into the squares of two adjacent allies, and then run out of movement, you can't end your movement in the second ally's square; neither, however, can you end your movement in the first ally's square. You have to go back prior to that. So just because one square is illegal doesn't mean you can ignore the legality of the previous square - you need to check that one too.
If you're considered to be your own enemy, then you can't end your movement in the last square you move into, because that would be ending your movement in an enemy's square. Neither can you end your move in the square prior to that, because if you end your movement there, that's your square, so you'll be ending your movement in an enemy's square. Neither, of course, can you end your movement in the square before that, for the same reason... and finally, neither can you end your movement in the square you started in, again for the same reason.
You can't move any further, because you've run out of movement, but there's no square that's legal for you to end your movement in, because any square you attempt to end your movement in is your square, and thus an enemy's square, and thus illegal.
-Hyp.