The trio return to Hogwarts on the Hogwarts Express. Dementors board the train during the journey, searching for Sirius, and enters the trio's compartment, prompting Harry to pass out. New Defense Against the Dark Arts professor Remus Lupin repels the Dementor with a Patronus Charm. At Hogwarts, Albus Dumbledore announces that dementors will be guarding the school while Sirius is at large. Hagrid is announced the new Care of Magical Creatures teacher. Hagrid's first class goes awry when Draco Malfoy deliberately provokes the hippogriff, Buckbeak, who attacks him (although it was kind to Harry). Draco's father Lucius Malfoy has Buckbeak sentenced to death.
Sirius is rumored to have entered the castle but isn't found. During a stormy Quidditch match, dementors overpower Harry, causing him to fall off his broomstick, which is then destroyed by the Whomping Willow. Lupin secretly teaches Harry to defend himself against dementors, using the Patronus charm. At Hogsmeade, a shocked Harry learns that Sirius is his godfather and was his parents' best friend. Sirius was accused of betraying the Potters' hiding location to Voldemort and murdering their mutual friend Peter Pettigrew.
The trio visit Hagrid to console him over Buckbeak's impending execution. When Ron's pet rat Scabbers escapes, a large dog appears and drags both Ron and Scabbers into a hole at the Whomping Willow's base, which is actually an underground passage to the Shrieking Shack. The trio discovers that the dog is actually Sirius, who is an Animagus. Lupin arrives and embraces Sirius as an old friend and helped him into the castle. Lupin admits to being a werewolf, and explains that Sirius is innocent. Scabbers is actually Pettigrew, an Animagus who committed the crime for which Sirius was convicted, much to Ron's surprise. After he was forced back into a human, Lupin and Sirius prepare to kill Pettigrew, but Harry intervenes; Pettigrew is instead to be turned over to the Dementors.
The full moon rises; Lupin transforms into a werewolf, he and Sirius fight in the animal forms, and Pettigrew escapes in his rat form. Sirius and Harry are attacked by dementors. Harry sees a figure save them by casting a powerful stag Patronus. He believes the mysterious figure is his dead father, and passes out, awakening to discover that Sirius has been captured and sentenced to the Dementor's Kiss. Acting on Dumbledore's advice, Harry and Hermione travel back in time, watching themselves repeat the night's events. They save Buckbeak and witness the Dementors overpower Sirius and Harry. The present Harry realizes that he himself was the one to cast the Patronus, not his father, and rushes to do so. Harry and Hermione then rescue Sirius, who escapes on Buckbeak. Lupin resigns, as parents will object to a werewolf teaching their children. Sirius sends Harry a Firebolt broom, and Harry happily takes it for a ride.