If what you had described is correct, then it is definetly not from this world.
I have known many people{close friends of mine}who had similar experiences.
Usually these type of occurences happen because someone is trying to stop or hinder the will of God and what God has planned for you.
The greater the plan he has for you, the Wicked one and his fallen cohorts will make every effort to overtake you.
PRAYER, it is very powerful against the enemy, usually at certain moments it seems as if the wicked one is overpowering you by either physical pain or either by the sons of disobedience who are controlled by principalities.
But now that you have experienced such strange matters, go and pray before it occurs again, and put and equip yourself with the full armour of God.
If it still occurs than go to fasting.
God Bless!