There are immense shades of gray throughout the characters of How I Met Your Mother. All outwardly likable at first glance, the HIMYM characters evolve so much that it's hard to deny how much of the fan base still harbors at least some contempt for characters like Ted and Barney.

RELATED: How I Met Your Mother: 5 Times We Felt Bad For Marshall (& 5 Times We Hated Him)

Marshall Eriksen (Jason Segel), on the other hand, is a character who tends to be universally beloved by the audience. He's goofy and confident and a fun person to spend time with, undoubtedly. However, there are myriad instances on the CBS sitcom that reveal Marshall to be more than a good person. Sometimes, he embodies the qualities of the detestable "nice guy."

Nice Guy: The Judge Position

Marshall on the bus with his son sitting next to a woman in a scene from How I Met Your Mother

Of course, it's not a bad thing to accept the position of a judge offered to Marshall in the final season of How I Met Your Mother. However, it's the way he goes about it that posits Marshall as a "nice guy" in the world of the show.

Marshall and Lily are one of the show's most dependable couples, but they sometimes hardly act like it. In this case, Lily plans for their future in Italy after taking another art job. But Marshall accepts an offer to become a judge in New York. Just because it's his dream, that doesn't make his duplicitous behavior instantly forgivable.

Good Person: Northern Comfort For Robin

Robin and Marshall Little Minnesota How I Met Your Mother

Marshall and Robin were not paired together too frequently, but when they were, it often revolved around being in a bar. For example, they both jockey for ownership over the Minnesota Tidal Wave drink at the MacLaren's bar.

But the time he spends with Robin in a Minnesota-themed bar shows how good a friend and a person he is. Homesick Robin is immediately comforted by the northern sensibility and paraphernalia. That's just the kind of person Marshall is.

Nice Guy: The Slap Bet

Slapsgiving slap HIMYM

One could argue that every time Barney was slapped, he definitely had it coming. However, after nine seasons of teasing out the same threat over and over again, it definitely got kind of old, especially for the friend group.

RELATED: How I Met Your Mother: How Marshall Changed From Season 1 (& How He's The Same)

Marshall seems to derive genuine joy from tormenting Barney and mocking him when his friend winces from the pain. At a certain point, it goes from funny to sad, but Marshall is blind to the idea that this joke is righteous and that he's not really a "nice guy" by the end of it.

Good Person: His Father's Funeral

How I Met Your Mother sad scene

One of the more heartbreaking arcs on How I Met Your Mother revolves around the death of Marshall's father. However, the funeral reveals how good of a person Marshall is by exposing the immense heart he has.

When he eventually hears the final voicemail his father left for him, Marshall breaks down in tears, showing how strong his love is for the people in his life. No one with that much emotion can be one hundred percent a "nice guy."

Nice Guy: Beercules

Marshall drunk, holding a cocktail

For the most part, when the characters on How I Met Your Mother get drunk, they do so with good nature and good humor. However, Marshall engages in some pretty contentious behavior.

A drunk alter-ego of Marshall's, Beercules, is marked by his tendency for streaking. It seems humorous and harmless at first glance, but the contexts of his streaking are not okay and have definitely not aged well for Marshall's "wholesome" personality.

Good Person: There For Ted

Ted and Marshall sit on the couch in their apartment watching Star Wars in How I Met Your Mother

There are many instances in which Marshall is there for his friends, but this particular time on HIMYM comes when Marshall and Ted envision their futures in "Trilogy Time," while watching the Star Wars films.

RELATED: How I Met Your Mother: 10 Saddest Things About Marshall

Ted immediately becomes existential when he thinks of his friends moving on without him. But just as he did while watching the Washington Generals, Marshall comforts Ted and assures him that the future is "different" from what they think it'll be. Ted could be a lot, but Marshall was always there for him.

Nice Guy: Lily's Future

HIMYM Ted Consoles Marshall After Break Up

At the end of season one, when Lily begins to question what she actually wants to do with her life now that she's an adult, Marshall does his best to be understanding. Lily's desire to become an artist did come out of nowhere.

However, even though he eventually admits his true feelings about her decision, he does so with rage and lots of finger-pointing. Even he didn't do it consciously, he unleashes a full-on guilt trip for Lily and it's not the most fun thing to watch.

Good Person: Thanksgiving With Lily's Father

Thanksgiving Lily's father

At first glance, inviting Lily's father, portrayed by Chris Elliott, to Thanksgiving might seem like a total "nice guy" move by Marshall Eriksen. Over the course of the installment, though, it's revealed to be quite the opposite.

Lily had a toxic relationship with her father and Marshall's gambit was incredibly risky. By the end of the episode, though, they make amends and Marshall's ability to see the best in people truly paid off.

Nice Guy: Pregnancy Lies

Marvin Eriksen is born

In one of HIMYM's many Doppelgangers episodes, Lily and Marshall decide that the final doppelganger sighting will give them the green light to finally have a baby. Conversely, Marshall clearly wants a baby more than Lily does.

RELATED: How I Met Your Mother: 10 Things About Marshall That Would Never Fly Today

As such, he plays up the idea of a doppelganger being found and refuses to let Lily in on the information he has that it was not actually a doppelganger, but was rather just Barney. It's incredibly manipulative and shows Marshall as a "nice guy," who looks out for his own interests first and pushes his own agenda selfishly, even if he'd eventually renege.

Good Person: Gruber Pharmaceuticals

Environmental law Marshall

The testament to the fact that, at the end of it all, Marshall really is a good person at heart does not come from his interactions with his friends. Instead, it revolves around his standing as a moral paragon in his career.

There are times when Marshall compromises his values for a job (like working at GNB). However, when he faces off against Gruber Pharmaceuticals in court, he's fighting for environmental justice. There may be no greater nobility these days.

NEXT: How I Met Your Mother: 5 Ways Marshall Is An Overrated Character (& 5 Ways He Is Underrated)