Since their debut as part of the Transformers toy line in 1984, Autobot chief Optimus Prime and Decepticon lord Megatron have shared a longstanding feud that's led to countless epic battles across several mediums including comics, video games, television shows, and a popular movie franchise. Like the duelists in Joseph Conrad's novel, The Point of Honor, these two rivals have spent their entire adult lives engaging in one vicious contest after another, unable to back down or away.

RELATED: 5 Autobots Who Could Succeed Optimus Prime as Leader (And 5 Who Shouldn’t)

Sometimes, however, when a greater threat comes along, they've been forced to team up with amazing results. And although these team-ups were reluctantly executed, the results speak for themselves. For as great a rivalry as they share, Optimus Prime and Megatron make great allies just as much as they do enemies. But which role do they fit better? Here are five reasons Optimus and Megatron are the perfect rivals (and five reasons why they are the perfect allies).

10 Allies: Their Complicated History

The complicated backstory relationship between Megatron and Optimus Prime is one that makes them perfect allies. Regardless of the continuity -- whether they were friends (G2), brothers (movie franchise), or a murderbot and victim (G1) -- no one knows Optimus Prime better than Megaton, and no one knows Megatron better than the leader of the Autobots himself.

Because of this, the synergy they display when battling together is unparalleled. Consider their fight with Unicron in Transformers: Prime. The synchronicity with which they dispatch Unicron's forces and saved Cybertron is like a well-oiled machine, brutal and without mercy when their homeworld is on the line. Because of this teamwork, they were able to take down Unicron using the Matrix of Leadership and save the planet.

9 Rivals: Yep, Their Complicated History

Conversely, one of the reasons Megatron is also Optimus Prime’s perfect rival is because of their complicated history. According to Transformers: Prime lore, Optimus Prime was once an archivist known as Orion Pax who befriended a gladiator bot named Megatronus. The two become close comrades as they shared the same ideals: an egalitarian society where Cybertronians lived free of the oppressive caste system plaguing their civilization.

RELATED: 5 Of The Best Transformers TV Shows (& 5 Of The Worst)

Since they know each other so well, Megatron is uniquely positioned to be a thorn in Megatron's side eternal and vice-versa. Not only this, but the fact that they were close friends makes their feud all the more emotional, especially when Optimus laments over their lost friendship like he does in G2's Jihaxis arc.

8 Allies: When They Team Up They Save The World

Another reason Optimus and Megatron make great allies is what happens when they team up: They save the world! Whether it’s defeating Unicron or taking down Sentinel Prime, when the leaders of the Autobots and Decepticons put their heads together the universe is a safer place.

One of the greatest team-ups of the franchise occurs in G2 when a drill goes rogue and begins boring a tunnel deep into the Earth's core. In order to stop the drill from destroying the planet completely, the Decepticons and Autobots link up to combine two pieces of key technology (a dominator dis-control box and a nullifier). The end result works like a bomb all because Optimus and Megatron put their feud on hold.

7 Rivals: We Are The Same, You & I

Megatron and optimus prime fist fighting

Another reason why Optimus and Megatron make great rivals is that they literally share the same goal of creating a free and equal society on Cybertron. The only difference? Megatron believes violence is imperative to achieving this endgame while Optimus opts for diplomacy, pitting them on opposite sides of the same coin. Once again returning to the Transformers: Prime continuity, Rachet highlights their stark differences in methodology through a backstory monologue.

RELATED: Transformers: 10 Best Quotes From Optimus Prime

In the monologue, he tells the tale of how Optimus and Megatron go before the Cybtronian high council to propose abolishing their society's oppressive caste system. However, Megatron openly proclaims the only way to overthrow the old guard is through violence. When Optimus claims peace is the best way to achieve change, the council sides with him, setting Megatron on the path of rebellion.

6 Allies: No, We Really Are The Same

Alien structures in Transformers Dark of the Moon.

Beyond their differing points of view, Optimus and Megatron truly want the same thing. They are passionate, driven, and put the needs of their people above themselves. And this is exactly why they make for perfect allies.

Consider their team up against Sentinel Prime in the Transformers: Dark of the Moon comic adaptation published by IDW. Unlike the film, in this version, Optimus and Megatron join forces to stop Sentinel Prime from turning the Earth into Cybertron, killing the villain and sending Cybertron back through the space bridge -- a team-up that leaves Megatron wondering what more they could accomplish as allies.

5 Rivals: Megatron Has Killed Optimus Too Many Times

Optimus Prime has lived many lives and experienced just as many deaths at the hands of Megatron, making the leader of the Decepticons the perfect rival for the franchise's hero. In almost every continuity there features a version of Megatron murdering Optimus in some shape or form.

RELATED: Transformers: 10 Best Quotes From Megatron

Perhaps the most famous instance of this takes place in Transformers: The Movie (1986). After conquering Cybertron, Megatron travels to Earth to face Optimus once and for all. In a battle of epic proportions, the two rivals mortally wound each other, resulting in the latter dying after passing on the Matrix of Leadership to Ultra Magnus.

4 Allies: Armada, 'Nuff Said

Optimus Prime promo art for Transformers: Armada.

Calling back to franchise supervillain Unicron, nothing demonstrates great teamwork quite like the time Optimus and Megatron shook hands to form the armada. The occurrence happens in the Japanese animated television show Transformers: Armada where the introduction of mini-cons causes the planet eater to activate.

After several attempts to win Megatron's allegiance, the rivals join forces when Unicron finally awakens. In similar fashion to Transformers: Prime, the warriors battle their way through Unicron’s innards, only this time Megatron dies after Unicron is defeated, claiming he doesn't want to live in a world of peace.

3 Rivals: Their Battles Are Too Epic For Friendship

Megatron and Optimus Prime doing battle

Legendary battles are the stuff of great rivalries, and Optimus and Megatron have shared some real doozies over the years. In fact, they've had such great fights that the thought of a permanent alliance almost seems sinful. From the space bridge skirmish in Transformers: Prime to the epic wars of the movie franchise, nothing quite says Transformers like a clash between these two titans.

RELATED: 5 Decepticons Who Would Be Better Leaders Than Megatron (& 5 Who Would Be Worse)

Perhaps the best example is G1's Battle of the Sherman Dam. Armed with melee weapons, the two clobber each other on a catwalk to the backdrop of crashing waves. However, Megatron ultimately gains the upper hand when Optimus is momentarily distracted by cries for help, knocking his opponent into the reservoir below.

2 Allies: Together They Cure Plagues

Transformers G1 saw the rise of a new global pandemic known as the Hate Plague – a disease so powerful it could even infect the likes of a Cybertronian. When infected, a Cybertronian instantly turns the color red, becoming wildly aggressive towards everyone and every thing around it.

Optimus Prime and Megatron once again align in order to thwart this new deadly virus, which infects many Decepticons upon outbreak. However, after learning the plague can be destroyed using pure, undiluted knowledge, the duo deploys the Matrix of Leadership and kill the virus at long last.

1 Rivals: Their Identities Are Tied To Their Rivalry

Megatron Transformers - Palpatine from Star Wars other character friends

In Paramount's Transformers: Dark of the Moon, Megatron poses a question to Optimus just after shooting Sentinel Prime in the back: "Who are you without me, Prime?" And this is the question as Optimus Prime and Megatron's feud has gone on for so long, the two eat, sleep, and breathe inside each other's headspace.

Nothing exemplifies this better than Megatron's response to Optimus Prime's death in Transformers Vol. 5: "Breakdown". Optimus Prime is dead and the Autobots mourn his passing. But none as much as Megatron who has a literal nervous breakdown over the event.

NEXT: 5 Things That Were Great About Transformers: The Movie (& 5 That Really Sucked)