Sounds like you were "running on instinct" and the thinking portion of your brain was being controlled by your limbic system and brain stem.
Once a person knows that's the reason though, its sort of like pulling the curtain aside and revealing the true Wizard of Oz. Once a person realizes where, how and why urges happen, the urges lose their mysterious urgency and become easier to control. At least, that's the way it was for me...