At the end of Order of the Phoenix, Voldemort possesses Harry and is hurting from the possession. I feel like the book suggested that it was his mother's love that protected Harry, but Voldemort by that time had taken Harry's blood already. Why wasn't Voldy immune?
Voldemort had never known, understood & acknowelded love. Right from his childhood to becoming Voldemort, he lead a hateful & envious life.
Insecurity, helplessness, fear, emptiness, hatred & revenge. Voldy feasts on those things.
When Voldy knows about his connection with Harry, he tries to posses his body & eventually
control his soul.
Harry is an impulsive & irrational soul. He has already known pain & suffering before his Hogwarts days & he finds love in Hogwarts in the form of Ron, Hermione, Dobby, Dumbledore etc.
In OOTP, he is made to look as a
culprit & disdained upon. Even Dumbledore avoids Harry due to the eventual foreshadowing. He is filled with self-doubt, negativity & a certain sense of revenge against the ministry.
Insecurity check. Revenge check
When Voldy attacks Mr. Weasly & Harry has a vision of it. Helplessness check
When Voldy disillusioned Harry to believe he has captured Sirius. Fear check
During the fight in the ministry, when OOTP members appear. Hope
When Bellatrix kills Sirius, a (god)father to Harry. Emptiness check. Revenge check
Harry is at his most vulnerable at that moment, Voldy can posses his body & control his soul. But, the mighty Dumbledore is there to deliver the best line in the book "Harry, it isn't how you are alike. Its how you are not"
Harry sees his friends faces & those memories start coming back to him
Love, friendship, empathy, sacrifice, gratitude
All those coming at once in his mind render the opposite feelings weak. So Voldy starts feeling those alien feelings inside his mind which he cant bear, not all at once. So he escapes like a coward from Harry's body & the ministry atrium.
Harry’s love and emotions for Sirius drove the Dark Lord out.
The Dark Lord was forced out of possessing Harry when Harry was overwhelmed by emotion at the thought that if he died he’d see Sirius again. It’s right when that happens that he released Harry, that’s what made it painful for the Dark Lord to possess Harry and why he was forced to stop.
“Let the pain stop, thought Harry … let him kill us … end it, Dumbledore … death is nothing compared to this …
And I’ll see Sirius again …
And as Harry’s heart filled with emotion, the creature’s coils loosened, the pain was gone; Harry was lying face down on the floor, his glasses gone, shivering as though he lay upon ice, not wood …”
- Harry Potter and the Order of the Phoenix, Chapter 36 (The Only One He Ever Feared)
It’s not Harry’s mother’s love that makes it painful for the Dark Lord to possess him, it wasn’t painful at first - it’s Harry’s own emotions. Dumbledore explains it to Harry as well.
“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.”
- Harry Potter and the Order of the Phoenix, Chapter 37 (The Lost Prophecy)
The Dark Lord couldn’t stand possessing Harry when he was feeling so much love.