Would The Office really have been anything if it weren't for Jim Halpert's incessant pranks and tit for tat with Dwight Schrute? The two make an unlikely pair-- which is why they work so well together on screen. Their conflicting personalities cause a natural rift between Dunder Mifflin's two top-performing salesmen.

It's true that Jim's charming character has been called into question over the years, but he wasn't without his friendly moments. Despite his best efforts, Jim acted as a solid friend to Dwight on a number of occasions. Dwight even made Jim his Best Man at his wedding in the final season. But before they got to this heart-warming moment, Dwight had to endure a lot of Jim's pranks over the course of 8 years (technically more considering they worked together before The Office documentary). So here are 5 times that Jim was a good friend to Dwight and 5 times when he was just way too cruel.

RELATED: The Office: 10 Storylines That Were Never Resolved

Nice: Dwight Christmas

When the party planning committee forgets to plan the annual Christmas party, Jim gives Dwight permission to set up the office for a traditional Schrute Pennsylvania Dutch Christmas. Despite the rest of the employee's lack of encouragement, Jim and Pam Dwight in his strange festivities. Dwight dresses up at the bearer of gifts, the Belsnickel, and treats the party to German food and a game of "Naughty or Nice." While Jim is enjoying these typical antics, he announces he has to leave for his sports job in Philadelphia. Dwight becomes so upset at Jim's absence that he cancels the Schrute Christmas party altogether. This is such a touching moment as its really the first time that Dwight really shows how much his co-worker means to him. Jim reciprocated by reing his colleagues at the office where Dwight happily resumes his role as Belsnickel.

Mean: Company Time

Jim and Dwight from The Office comedy series.

In the season five episode, "Business Ethics" Jim really makes it known that he is a co-manager. When discussing the prospect of "stealing company time" by taking too many breaks, Dwight proudly proclaims that he has never stolen time away from Dunder Mifflin. Jim calls him on his bluff and starts noting anytime he takes a break, including going to the bathroom and even yawning. While this can just be brushed off as another one of Jim's quirky pranks, it really seems as though Jim was throwing his managerial role in Dwight's face. Jim knew that Dwight had been pining over that role for years, so it seems pretty unprofessional that Jim uses his power for his own amusement.

Nice: Staying At Schrute Farms

The Office Jim Pam Dwights Beet Farm

When Dwight announces that he will be running a bed and breakfast on Schrute Farms, Jim happily takes the bait. He brings Pam to enjoy a nice romantic weekend of beet wine-making, manure shoveling, and a nice Harry Potter bedtime story read by Dwight himself.

RELATED: Deangelo Vickers: Will Ferrell's 10 Most Memorable Quotes on The Office

During the night, Jim hears Dwight wallowing over Angela which really changes his mood over the whole experience. Jim and Pam feel sorry for him, so they try to cheer him up by actively participating in Dwight's bizarre excursions. They even leave his farm a glowing review on Trip Advisor (which you can actually read in real life, by the way).

Mean: When He Induced "Operation Overthrow"

Dwight heating a doorknob in The Office.

In season seven, Dwight lands the role he's been longing for. When Deangelo Vickers (Will Ferrell) lands in a coma, Dwight becomes the acting manager of Dunder Mifflin. By this time, it's pretty established that Jim knows that this is Dwight's dream job, and instead of being happy for him, he tries to dimish the opportunity. He tells Dwight that he is orchestrating an operation to overthrow Dwight called "The Fist." One thing leads to another, and Dwight decides to purchase a gun which he accidentally fires near Andy Bernard, causing him to have temporary hearing loss. Dwight tries to bribe his co-workers into silence, and instead of calming down the antics, Jim decides to continue pranking Dwight by making him do submit to preposterous things. Granted, Dwight took his role as manager a little too seriously, but Jim poking fun of him only escalated the situation.

Nice: When He Saved His Job

Pam Dwight and Jim talking in The Office finale

A team of Dunder Mifflin employees, including Jim and Dwight, make their way to Florida to help Robert California's new Sabre initiative. It's during this trip that California names Dwight the Vice President of the new business plan. However, while playing golf the manager lets slip to Jim that he plans on scrapping the entire plan and firing Dwight over it. Desperate not to let Dwight take the fall the next day when he presents the plan to Sabre's higher-ups, Jim tries to warn his friend. When Dwight dismisses the accusation, Jim even tries to physically stop him from going to the meeting. Dwight ultimately transcends, and Todd Packer is fired instead. This is a staggering moment, considering Jim doesn't particularly enjoy working next to Dwight. It really shows his comion and makes audiences synthesize with their charming, albeit strange, friendship.

Mean: And Then Almost Had Him Fired

In season 8's "Christmas Wishes" episode, Andy (who is now the manager of Dunder Mifflin) is adamant about making everyone's Christmas wishes come true. While dishing out gifts throughout the office, Jim and Dwight are busy pulling pranks on their fellow coworker. Andy then tells them to cease their pranking rampage or they will have to forfeit their annual bonus to the other. This causes even more rivalry between the two and they go back and forth trying to get the other in trouble so that they can absorb a higher bonus. Jim takes is a step too far when he defaces a picture of his daughter and blames it on Dwight. Andy says it's a fireable offense, so Jim has to it that he, in fact, destroyed the picture.

Nice: When He Gave Him Relationship Advice

Rainn Wilson and John Krasinski as Dwight and Jim in The Office

This heart-to-heart really pulls at the heart-strings. Dwight is overcome with emotion when Angela breaks up with him and starts dating Andy; so much so that he retreats to the stairwell to indulge in his depression.

RELATED: Dwight From The Office Nearly Got A Spinoff: Here's Why It Was Cancelled

Jim finds him here and decides to give him some love advice. He tells Dwight that it was hard for him to be around Pam when she was with Roy and further tries to relate to him to ease Dwight's sadness. This scene really shows that Jim does care about Dwight, despite their usual differences.

Mean: When He Tricked Him Into Buying A Plane Ticket

Rainn Wilson as Dwight Schrute in The Office

In ing during The Office eighth season, Dwight mentions that Jim once convinced him that he won a role in the TV series, NCIS. Dwight, thrilled at the opportunity, buys a plane ticket to California which is quite a ways from Pennsylvania. The plane ticket, not to mention time wasted, had to be costly for Dwight. And as always, it all happened because of Jim's relentless need to prank his co-worker.

Nice: When Jim Took Dwight To The Hospital

Dwight and Jim with Lloyd Gross

Jim's constant back-and-forth with Dwight is mostly written off as innocent pranking. He clearly has some level of affection for him, as it's apparent throughout the entire series. Anytime Dwight is in real danger, Jim takes it upon himself to take care of Dwight. He did this after Dwight crashes his car in his haste to "save" Michael, which leads to a concussion. Jim eventually takes Dwight to the hospital, despite Michael's claims that Dwight is fine and his charred foot (courtesy of his George Foreman grill) is much more of a concern.

Mean: When His Prank Almost Killed Dwight

Despite Jim's conscious good intentions, sometimes he just doesn't realize when he pranks have gone too far. While in Florida, Dwight complains of stomach pain, which Jim takes as an opportunity to mess with Dwight. He hints that he has poisoned Dwight throughout the season eight episode "Tallahassee." Eventually, it becomes quite obvious that Dwight has a severe health problem. After he collapses, paramedics he has appendicitis and Dwight rushes into surgery. Who knows what may have happened if Jim had continued to carry on this prank.

NEXT: Dunder Miffed: The 10 Most Entertaining Rivalries On The Office