In the Harry Potter series, Harry had many unusual friends and allies.  Dobby, the house-elf who yearned to be free and had an... interesting fashion sense, was one of the most loyal.  However, Dobby had a tendency to go to extremes to solve problems, often landing Harry and friends in hot water.

RELATED: Harry Potter: 10 Facts You Didn't Know About Dobby The House Elf

Though Dobby got Harry arrested, de-boned, and captured by Dolores Umbridge, he also saved Harry's life more than once and was a loyal friend to many lonely creatures and wizards.  Despite his mistakes, Dobby won Harry's affection—and the undying love of Harry Potter fans everywhere. Here are 5 times Dobby was a jerk, and 5 he was the true hero of the series.

Jerk: Convinced An Eleven-Year-Old Child That His Friends Had Forgotten Him

Harry and Dobby in his room in Harry Potter

Harry Potter's home life always left something to be desired, but his first summer home from Hogwarts was especially miserable.  His new friends Ron Weasley and Hermione Granger had gone totally radio silent.  Harry didn't receive a single letter all summer and was sure that his friends had forgotten him entirely. Meanwhile, Ron and Hermione were worried sick because Harry never replied to their letters.  Dobby had been stealing them all in an effort to convince Harry that his life at school would be so miserable and lonely that he shouldn't go back.  Sure, Dobby's motives were pure, but his chosen method left three young children lonely and scared on summer vacation.

Hero: Defied His Masters At Great Personal Cost To Try To Save Harry

Dobby is scared in Harry's room

When Harry first met Dobby, Dobby felt bound to inflict punishments on himself that he was certain his masters would assign if they knew his behaviors - a gruesome litany including shutting his ears in the oven door and beating himself on the head.  Dobby even told Harry that his masters reminded him to do extra punishments when they felt his behavior was not up to scratch.

RELATED: Harry Potter: 10 Details About House Elves You Probably Missed

Although his own life remained harsh, Dobby told Harry that he knew many other house elves whose lives improved immensely when Voldemort died.  Dobby was willing to risk terrible punishment to leave Malfoy Manor and try to protect Harry, a boy he had never met, for Harry's service to other house elves, though the benefits had passed Dobby by.

Petunia Dursley had spent hours crafting a beautiful pudding for her husband's business dinner.  Though Dobby must have been intimately familiar with the work that goes into the creation of a special pastry, he used a hover charm to smash Petunia's pudding to the ground - and all over the Dursleys' uninvolved dinner guests.

In the end, Dobby's deed wasn't so harmless.  Harry was immediately contacted by the Ministry of Magic for violation of the two laws.  It was this official warning that allowed the Ministry of Magic to use Harry's heroics on a Muggle street to call for immediate expulsion and a formal legal hearing in Half-Blood Prince.

Hero: Took Care Of A Fellow House Elf In Need

Though she got little screen time in the films, Barty Crouch's troubled house-elf Winky was a tragic figure in the books.  Winky was fired after a high-profile incident with Death Eaters, though she was not at fault.  She struggled to find another placement because of the scandal.  Dobby took her in and helped secure her a spot working at Hogwarts.  Though Winky developed a drinking problem, Dobby helped care for her and cover her responsibilities when other house elves met her with scorn.  Dobby's compassion and sweetness made all the difference for an otherwise-abandoned friend; Winky was able to recover and take pride in her life and work.

Jerk: Purposefully Injured Harry

Dobby's poorly-conceived plot to injure Harry so badly he'd have to leave school is a form of help anyone would do better without.  Dobby enchanted a bludger to attack Harry during a Quidditch match.  The rogue bludger broke Harry's arm.  Sure, Professor Gilderoy Lockhart's inept healing spell made the injury exponentially worse by removing all the bones from Harry's body.  But it is ultimately Dobby who was responsible for Harry's long, painful night in the Hogwarts infirmary - not to mention a lifetime of bone-related body horror.

Hero: Befriended The Friendless

Dobby's natural charm and big heart made room for even the oddest denizens of the wizarding world.  Albus Dumbledore's reclusive brother Aberforth had few friends to speak of - except, of course, for his trusty goats.  After coming to Hogwarts, Dobby befriended the lonely man who would eventually be a key part of Voldemort's downfall.  Dobby's friendship with Aberforth is a sweet reminder that misfits can be stronger and happier together.

Jerk: Broke The House Elf Picket Line

Dobby on Harry's bed in Chamber of Secrtes

Hermione's enthusiastic attempts to improve conditions for house elves were not always very respectful.  Hermione brought fixed ideas about freedom involving work for wages and vacation time that were often at odds with the house elves' own expressed desires and long-held cultural norms.  After the Hogwarts house elves repeatedly told Hermione that they did not want freedom as she defined it, Hermione knitted clothes and left them around Gryffindor Tower in the hopes that house elves would pick them up by mistake while cleaning and be freed.  The house elves found this so insulting that they all refused to clean Gryffindor Tower.

RELATED:  Harry Potter: Every One Of Harry's Quidditch Matches, Ranked

Perhaps experiencing consequences or peer pressure would have helped Hermione to listen to the creatures she hoped to help.  However, Dobby broke the house elves' embargo on cleaning Gryffindor Tower and did all the cleaning himself.  It is probable that the other house elves did not appreciate Dobby's breaking of their strike.

Hero: Risked His Neck For Ron Weasley - And Saved Harry's Triwizard Chances In The Bargain

Although Dobby's part in Goblet of Fire didn't make it to film, the fourth Harry Potter book saw some of Dobby's sweetest heroics.  When Ron Weasley gave Dobby an unexpected Christmas gift of a sweater and socks, Dobby was deeply touched.  His loyal heart attached itself to Ron from then on.  When Dobby learned that Ron would be kidnapped and trussed up under the lake as part of Harry's second Triwizard Tournament task, Dobby didn't leave Ron's fate to chance.  And a good thing, too - Harry had failed to adequately prepare for the task and would have bombed spectacularly if Dobby hadn't intervened to provide Harry with gillyweed at the last moment.  Thanks to Dobby, Harry made a fine showing and Ron was freed from his underwater captors.

Jerk: Got Harry Potter Collared By Dolores Umbridge

While Dobby's jerk factor decreased after he left the Malfoys' service, some old habits die hard - at Harry's expense.  Dobby went the extra mile to disobey Dolores Umbridge's orders and warned Dumbledore's Army that they had been busted.  However, Dobby got carried away by his self-punishing habits. Harry had to spend precious moments stopping Dobby from harming himself and giving Dobby explicit instructions that he was to lie to Umbridge and refrain from further hurting himself.  While Dobby's self-punishment may be more sad than jerky, his ill-timed remorse ensured that Harry was caught, leading to a chain of events that resulted in Dumbledore's exile from the school and harsh punishment for Harry.

Hero: Gave His Life To Save Harry And His Friends

Dobby's death in Harry Potter's arms

When Harry, Ron, Hermione and a host of others were imprisoned in Malfoy Manor, held by the dangerous Bellatrix Lestrange and know to be hosting Lord Voldemort himself, Dobby rose to the terrifying occasion.  Although Malfoy Manor held terrible memories for Dobby, he didn't hesitate to return to save Harry and his friends.  Dobby had already made one dangerous trip and returned to the Manor only to find that Harry had been forced to surrender to Bellatrix Lestrange.  Undaunted, Dobby dropped a chandelier on Bellatrix and gave Harry the opening he needed to disable his foes and disapparate.  This was to be Dobby's last brave act.  His injuries led swiftly to a sad, sweet death in the arms of his best friend.

NEXT:  Harry Potter: Rowling's 10 Most Interesting Fictional Beings