At the start of The Office, Dwight and Pam were anything but friends. They were merely co-workers who tolerated one another. Due to Pam's closeness to Jim (before they finally revealed their feelings for one another), Dwight often regarded Pam as an enemy. Over time, though, Pam and Dwight quietly formed a deep friendship without either of them realizing it. They may have gotten on each other's nerves more often than not but there was a quiet level of respect between the two.

RELATED: The Office: 10 Hilarious Pam Memes Only True Fans Will Understand

Over the course of nine seasons, let's take a look at 10 moments that prove Dwight and Pam were much closer than fans even realized.

WHEN HE COMFORTED PAM IN THE HALLWAY

In the third season, Jim was transferred back to Scranton from Stanford and brought along someone new: A girlfriend. Karen also worked at Dunder Mifflin and the two grew increasingly close. Seeing Jim in a happy relationship every day hurt Pam but things escalated after she encouraged Jim to take the next step with Karen. Pam didn't want the two to get serious but she was being a good friend.

Pam is then seen crying in the hallway, overwhelmed by the entire situation. Dwight sees Pam in puddles and surprisingly quietly approaches her and becomes her shoulder to cry on. He doesn't pry and doesn't rush her through the process, he simply sits and takes care of her.

HOW CLOSE THEY WERE DURING HIS CONCUSSION

When Michael was in need, Dwight hopped in his car in a hurry and headed to rescue him. However, on his way out of the Dunder Mifflin parking lot, Dwight hit a pole and got a concussion. Before anyone realized he had a concussion, Dwight was being incredibly nice to Pam and the two really bonded.

Pam admitted that Dwight was her friend but after she realized he wouldn't be that way forever, she gave him a long hug and helped him out of the office.

WHEN SHE MADE JIM WARN DWIGHT ABOUT ROBERT'S PLAN TO FIRE HIM

It wasn't Robert California's intention to single out and fire Dwight but he happened to be the man Nellie chose to be the vice president of special projects. Robert wasn't a fan of the project Nellie created and was planning to terminate the whole thing, unbeknownst to Dwight.

RELATED: The Office: 10 Hilarious Michael Scott Memes Only True Fans Will Understand

To save Dwight from losing his job, Pam told Jim to do everything he could to make sure he didn't accept the position in front of Robert California. It took a few sneak attacks but Jim (with the help of Pam) successfully saved Dwight and his job.

DWIGHT REALLY DID TRY TO MAKE PAM'S STAY ON HIS BEET FARM SPECIAL

The Office Jim Pam Dwights Beet Farm

Dwight may annoy everyone in the office but when it comes to business, he takes things seriously. Outside of Dunder Mifflin, Dwight had a beet farm that he was planning to turn into a bed and breakfast. Pam immediately jumped on the opportunity to spend the night there with Jim to see what Dwight's farm life is all about.

Instead of showing the two pranksters a horrible time, Dwight truly did everything he could to show them a pleasurable experience. He cooked for them, showed them traditional farming activities, and even read Harry Potter to them before bed. His sweetness prompted Pam to leave Dwight a good review online.

HE TOOK CARE OF CECE WHEN SHE WOULDN'T STOP CRYING

Dwight holding Cece next to Michael in The Office

As large and odd of a man Dwight is, he's surprisingly tender and emotional. This is proven when the office heads to Gabe's house for a Glee viewing party. Pam and Jim brought CeCe because they were having trouble getting her to sleep at night but thanks to Dwight's calming demeanor, he was able to settle CeCe down immediately. To encourage Dwight to continue holding her daughter, Pam told him they were close friends and Jim even fed Dwight pizza.

If Dwight didn't have a soft spot for Pam or her baby, he would have left them in their misery. He even gave up sleeping with Angela that night to help the Halperts!

PAM JOINED DWIGHT ON HIS SALES CALL WHEN HE DIDN'T KNOW HOW TO TALK TO WOMEN

Once Dunder Mifflin has an opportunity to pitch to the Scranton White Pages, Dwight realizes he'll have to make the pitch to a woman. The problem is, Dwight never does well on sales calls when he's talking to women.

RELATED: 10 Continuity Errors From The Office You Never Noticed

The women of the office try to help him but Pam decides to join Dwight on his call for further backup. It's obvious Pam went with him for the better of the company but it's also because she saw Dwight in a moment of need. And as fans will remember, the woman they ended up meeting was Jan!

HE STOOD UP FOR HER AGAINST FRANK

Dwight paints Nate's truck with Pam on The Office

As the president of special projects, Nellie asked Pam to paint a mural in the warehouse that depicted life at Dunder Mifflin. Pam worked really hard on the mural and was distraught when she realized someone defaced it by painting butts over it.

With the help of Dwight and Nellie, Pam finds out the defacer is a warehouse worker named Frank. Dwight then decides to help Pam in getting back at Frank by painting on his beloved truck, creating a sneaky moment between the two co-workers.

AS REGIONAL MANAGER, DWIGHT GAVE PAM SEVERANCE WHEN SHE QUIT

Pam Dwight and Jim talking in The Office finale

In the final season of The Office, Pam finally realizes her time in Scranton is up and that the family should relocate to Austin, Texas so that Jim can work somewhere he loves.

Both Jim and Pam go into Dwight's office to quit but before they can do so, Dwight fires them. The couple is upset at Dwight's petty decision but he quickly tells the couple that it's for their benefit because he can offer them severance until they get on their feet in Austin.

HE JOINED HER TO CATCH JIM IN A LIE

It's not every day when Pam and Dwight team up to get back at Jim. However, with Pam being severely pregnant, her hormones take over when she realizes her replacement, Cathy, is young and attractive.

Pam fears Jim is going to be attracted to Cathy while she is away on maternity leave. She tries to get Jim to admit that he finds Cathy cute but he doesn't take the bait. Pam tells the camera crew that she doesn't like dishonesty so she asks Dwight for help on how to catch Jim in a lie. Together, the two team up and produce some hilarious fails.

DWIGHT CONFIDES IN PAM FOR VALENTINE'S DAY

It's Valentine's Day at Dunder Mifflin and Dwight is pleasantly surprised when he finds a bobblehead version of himself on his desk. It's obviously from Angela but the two haven't made their relationship public yet.

Dwight is at a loss of what to give Angela in return so he asks Pam for help. The two have a nice heart-to-heart when Dwight tells Pam to stop talking because he thought of the perfect idea. He then makes a copy of his house key and gifts it to Angela.

NEXT: The Office: The 10 Most Annoying Things Jim Ever Did