read before downvoting.

This was quite some years ago in 6th grade and this situation still bothers me. 

Basically I was friends with an kid that had autism. I don't remember what kind of autism he had, he just couldn't register stuff right and he kind of had a lack of respect and no boundary for what he said. But I put that aside because it's not his fault he doesn't know when or when not to say stuff. 

One day I was taking a piss in the stall (I am a male) and not a urinal, because I was scared of using a urinal. I heard footsteps and didn't think of it, because it's a bathroom. I finished peeing and zipped up my fly, when I see a freaking head peeking out from under one of the walls (they were low, but not that low). I freaked out and let out a scream, not loud though. I did what my reaction told me to, and knee him in the face. It didn't break anything, but it obviously hurt him as he started crying and ran out. Note that I didn't know it was him before I kneed him, I just knew "hey someone crawled into my stall".   
We shared the same class for that period so I ran back to the class and he was outside with his aid. She was upset, which I can't blame given the situation. Turns out all he told his aid was something along the lines of "(my name) kneed me in the face!". However she was very understanding, and I had to explain to her that he crawled under my stall door on all fours and peeked at me. Nothing in terms of punishment happened, because she was very understanding and she thought that what I did was terrible, but given the fact that he crawled under my stall she accepted it. I apologized to him and he was indifferent about it. He didn't seem to hold a grudge on me though, it seemed like he forgot it or something.  I later told his parents because I was friends with them, and they understood that things like that could happen, so nothing bad happened to me after that. 

what do y'all think? was I in the wrong here, or was my action justified based on the situation?