J.k. Rowling said this quote

There is a room in the Department of Mysteries, that is kept locked at all times. It contains a force that is at once more wonderful and more terrible than death, than human intelligence, than forces of nature. It is also, perhaps, the most mysterious of the many subjects for study that reside there. It is the power held within that room that you possess in such quantities and which Voldemort has not at all. That power took you to save Sirius tonight. That power also saved you from possession by Voldemort, because he could not bear to reside in a body so full of the force he detests. In the end, it mattered not that you could not close your mind. It was your heart that saved you.