Someone who really didn't like you being there apparently! =)
It is possible that it was someone who has been there for some time and has "possession" of the house. No, no. Don't think back to horror films please. Let me explain.
I like to see hauntings in three steps. The first is, a spirit roaming or occupying an area. Sensitive people may sense them, see them, hear them, etc, but they're generally harmless. Not every spirit desires to make contact (benevolently or malevolently) but some do. So if one does, the second step--trying to gather energy. They begin making your electronics act weird, influencing people to act more negatively (if the spirit has malicious intentions), and generally just gather energy from everyone and everything they can. Once they gather enough energy, they use to manifest some form of physical act (be it sound, image, or movement). But then, you have the spirits that go even farther. Step 3 It's like they take over the entire house, as if it is a vessel they permeate (best way I can describe it). This takes a very very long time (years usually). The house will resonate their energy and instead of just being able to gather energy on a small scale, they use the entire building's energy as their own, like stepping into a suit--an extension of themselves. Of course this means they have access to more energy and can cause acts anywhere in the house at whim. This is the absolute hardest to get rid of and the strongest hauntings. Once you're inside, you're in their domain. Good thing is, once they take over a building, unless forced out, they never leave it. So it won't be following you.
My suggestion is, if it hasn't been demonstrating such violence toward your friend or anyone else who lives there, leave it alone, and don't go back there (it obviously has something against you). Removing a spirit that has planted roots and claimed residence to that degree should only be done by very experienced people. If this is your first time experiencing this, you're new to it. And since you panicked and ran, that means you fear it. And that right there will be your downfall if you choose to engage it. You need to be calm and have quick, clear thoughts and reactions.