Throughout nine seasons of The Office (2005-2013) salesman Jim Halpert (John Krasinski) and Dwight Schrute (Rainn Wilson) go from being co-workers and adversaries to pals. But their road to friendship is filled with potholes including pranks, sabotage, and scheming. At times, it's hard to tell who behaves worse: Dwight, who's simply being himself or Jim, who knows better but can't resist any chance to get under Dwight's skin.

RELATED: The Office: The 5 Worst Things Michael Did To Dunder Mifflin (& 5 Worst They Did To Him)

The back and forth between Jim and Dwight is fairly harmless, but there are occasions when each man blurs the line between office politics and all-out war. Here are the five worst things Jim did to Dwight, and five worst Dwight did to Jim.

Jim: Starts A Fight Between Dwight And Michael

Jim and Dwight talk to camera in the Office US

Dwight has many interests outside the office: paintball, beet farming, sci-fi movies, and martial arts. When Dwight reveals he's been made assistant to the senpai (master), Jim becomes determined to pit wannabe alpha males Dwight and Michael (Steve Carell) against one another in a fight to determine who is top dog. It starts with some schoolyard type taunting, progresses into a nausea-inducing gut punch and ends with the most ridiculous display of martial arts ever seen on the small screen.

Michael walks away victorious, but it leaves Dwight embarrassed and emasculated. All of this is orchestrated by Jim, and it causes a tiny fissure in the otherwise rock-solid regional manager and assistant to the regional manner relationship between Michael and Dwight.

Dwight: Steals Jim's Biggest Sale

An hour of sensitivity training becomes an excuse for Michael to multi-task: he's able to prevent the entire office from getting any work done while reinforcing negative racial and cultural stereotypes. This "diversity day" coincides with Jim's biggest sale, making it impossible for Jim to close the deal.

Someone who never has trouble when it comes to sales is Dwight, and he swoops in and steals Jim's sizable payday. Jim enjoys making fun of his fellow salesman but when it comes to Dwight absconding with 25 percent of Jim's annual commission, that's no joke.

Jim: Gets Physical

When the sales staff pairs off for a day, Jim and Dwight are stuck with each other. The twosome is a force to be reckoned with when it comes to closing, but as usual, their personalities clash when they aren't busy sealing a deal. Instead of pranking Dwight, Jim opts for straight-up meanness.

RELATED: The Office: 5 Reasons Why Jim And Pam Are The Best Couple On The Show (& 5 For Dwight And Angela)

When Dwight refuses to enter a building first for reasons that make perfect sense to Dwight but not anyone else, Jim smacks Dwight in the face and walks off smirking. This is no love tap, and Jim may not see this as any more egregious than his hundreds of pranks, but hitting someone in the face is a no-no under any circumstances.

Dwight: Attempts To Undermine Jim's Authority

Rainn Wilson as Dwight Schrute The Office

After years of lobbying for more power, Dwight must deal with Jim being promoted to co-manager of the branch. But when Jim and Michael have to decide who gets raises and who doesn't, Dwight stirs up trouble, making the process that much tougher on Jim.

Every attempt Jim makes to come up with a fair solution, Dwight effectively uses subterfuge to undermine him and further diminish Jim's quickly waning popularity among the staff. Dwight's goal? He's looking to start a revolution and oust Jim from his new seat of power. Dwight overplays his hand, but he does succeed in creating chaos and divisiveness, forcing Michael and Jim to hunker down in Jim's office, drink gin and wait out the storm.

Jim: Kicks Dwight When He's Down

THE OFFICE – Jim

After Angela (Angela Kinsey) dumps Dwight for mercy killing her cat, he's devastated. He also faces being made obsolete by the brand new Dunder Mifflin website. Desperate to win impress Angela and win her back, Dwight decides he's going to outsell the website.

In typical Dwight fashion, emotional vulnerability brings out the worst in him. Instead of being sympathetic (who would know better how to deal with heartbreak than Jim?), Jim decides to pull a prank that incorporates one of Dwight's worst fears -- artificial intelligence taking over the world. The timing is terrible, and Jim isn't even dissuaded when Pam (Jenna Fischer) suggests they show Dwight some mercy while he's going through a breakup.

Dwight: Catches Jim In A Lie

Dwight sitting at his desk and smiling in The Office

When Jim uses jury duty as an excuse to spend time at home with Pam and the kids, it's Dwight who figures out Jim isn't telling the truth. Determined to get Jim fired, Dwight tries every trick in the book to unravel Jim's tall tale.

RELATED: The Office: Jim's 10 Most Hilarious Pranks, Ranked

Jim's job isn't the only thing on the line: his co-workers won't be happy to learn the truth after picking up his slack for a week. Jim finds himself hustling to keep his cover story going while Dwight takes great pleasure in watching him squirm.

Jim: Messes With Dwight's Job Security

An image of Jim smiling in his talking head on The Office

Jim pulls a lot of pranks on Dwight, but sometimes he takes the joke too far, like posting a fake resume for Dwight on the internet. Jim even impersonates Michael to ensure Dwight gets a glowing recommendation.

Of course, Dwight manages to screw up any opportunity just by being himself. This doesn't stop Dwight from trying to leverage the possibility of an offer to gain favor - and possibly more - with Michael just when Dunder Mifflin is forcing the Scranton branch manager to downsize. Messing with Dwight on the job is one thing, messing with Dwight's job is a whole other level.

Dwight: Viciously Pummels Jim With Snowballs

Dwight looks through blinders

To be fair, Jim lobs the first snowball ... inside the office ... at Dwight's face, but Dwight's retaliation is not a proportionate response.

Dwight lures his unsuspecting co-worker to the parking lot where he ambushes Jim with a seemingly endless barrage of snowballs even after Jim falls to the ground and begs Dwight to stop. Jim emerges from the slaughter with a bloody nose and some PTSD. But Dwight doesn't stop there. He continues to launch surprise attacks that leave Jim shellshocked.

Jim: Dashes Dwight's Hope Of Becoming Manager

Jim Halpert in The Office

After Dwight's stint as acting manager ends after he fires a gun in the office, it's up to a search committee comprised of Jim, Toby (Paul Lieberstein) and Gabe (Zach Woods)  to fill the job for good. Dwight refuses to give up his dream, but for once, Jim is very serious about keeping Dwight from ascending the corporate ladder.

Dwight's rise to the top is inevitable, and even CEO Jo Bennett (Kathy Bates) sees potential in Dwight's craziness. The steady stream of oddballs who apply for the position promise to come with their unique brand of weirdness, so why not just stick with the devil you know? Jim gets his way which leads to an extended period of serious managerial instability and despite all his power trips and absurd proclivities, nobody wants the job or is more qualified to do it than Dwight K. Schrute.

Dwight: Rips Apart Jim And Pam's House

Dwight holds out his stapler at Jim

As Pam gives birth to her and Jim's first child, they dispatch Dwight to their house to get Pam's forgotten iPod. Despite strict instructions not to touch anything else, Dwight breaks in, ransacks the place and makes himself at home.

Like a demented Goldilocks, he sleeps in their bed (naked), takes a bath in their tub, reads a book and then decides to demolish their entire kitchen. There's nothing new parents love more than arriving home with a baby and find their privacy violated, and their love nest turned into a construction zone.

NEXT: The Office: 5 Times Phyllis Was Mean To Angela (& Vice Versa)