Chadwick Boseman stars as Thurgood Marshall in this biographical film. It follows Marshall as he became the first African American justice on the Supreme Court through the first cases of his early career.

The biggest surprise about “Marshall,” the new movie about one of Thurgood Marshall’s early court cases, is how funny it is.

Historical courtroom dramas aren’t usually described as laugh riots, so audiences have been a little shocked, according to director Reginald Hudlin, who has traveled the country hosting early screenings.

"I get this backhanded compliment, like, 'I knew I was going to like it, but I didn't know I was going to like it,'" Hudlin said recently with a chuckle, while he was in town for a screening at the Newseum. Viewers simply assume they're going to get a history lesson biopic about another Great Man.

Hudlin got his start in comedy. He directed “The Ladies Man,” “Boomerang” and the beloved 1990 cult hit “House Party,” which he also wrote. But in recent years he’s become a prolific television director, including plenty of work on dramas. Now he gets to do a little of everything, taking what you might call the “Hidden Figures” approach to history by putting as much emphasis on entertaining audiences as educating them.

“I hate medicine movies — you know the movies where people go, ‘You should see this, it’s good for you,’ ” Hudlin said. “There are so many of those movies, and I resent them.”

He once again dissolved into laughter.

Director Reginald Hudlin, left, and Chadwick Boseman. (Bill O'Leary/The Washington Post)

It’s not just Hudlin who drove the tone. It all started with a script by Connecticut lawyer Michael Koskoff and his screenwriter son Jacob Koskoff (2015’s “Macbeth”).

The elder admits that he wasn’t the one pushing the laughs.

“Jake is really great at knowing exactly when to inject the humor to break the tension,” Michael Koskoff said. “A couple of times we had disputes about it, and mainly I was the one against it.”

Now, though, he admits his son’s instincts were right.

The movie revolves around a little-known 1941 court case in Connecticut involving Joseph Spell (Emmy winner Sterling K. Brown), a black chauffeur accused by his boss’s wife (Kate Hudson) of rape and attempted murder. After news of the horrific allegations hit the papers, wealthy white families in the area started firing their black employees.

At the time, Marshall (played by Chadwick Boseman in the movie) was traveling around the country on behalf of the NAACP, helping black defendants — mostly in the South — fight a prejudiced system that was rigged against them.

He did the same for Spell but needed the help of a local lawyer and enlisted Jewish attorney Sam Friedman (Josh Gad), who had worked primarily on tax cases.

Marshall obviously worked on higher profile trials over the course of his career. He successfully argued Brown v. Board of Education in front of the Supreme Court — a body he would join in 1967, becoming the first black justice. But there are benefits to selecting a lesser-known case.

The fact that audiences didn’t read about it in a history textbook means they probably don’t know the outcome, which adds a dose of suspense.

Boseman stars as Thurgood Marshall, who traveled around the country on behalf of the NAACP early in his career. (Barry Wetcher/Open Road Films)

And Marshall was just in his early 30s at the time, still at the start of his career. Hudlin compares the movie to a superhero origin story, though he admits there are also elements of westerns, legal thrillers and buddy comedies.

The case is also remarkable because it’s not stereotypical. This isn’t a story populated by evil, racist Southerners and a black plaintiff whose character is beyond reproach. The story takes place in the North where the racism may be subtler, but it’s no less damaging. Spell, meanwhile, had plenty of flaws, including a dishonorable discharge from the military. But he still deserved a fair trial.

And that’s where Marshall and Friedman come in. The mismatched pairing of the handsome Boseman and portly Gad creates the “Odd Couple” dynamic that’s reliable for punchlines, but Marshall’s keen sense of humor wasn’t manufactured for the movie.

“We tried to draw a character that would replicate the young Thurgood Marshall, a man who very few people ever knew,” Koskoff said. “To bring out his wit, his sense of humor, his joie de vivre and his courage about going into these towns.”

In the film, Marshall is quick with a quip, a bit of a flirt and a big fan of telling stories. We see him out downing cocktails while teasing Langston Hughes and chatting up Zora Neale Hurston. This depiction of him came not just from biographies about the civil rights pioneer but also his own family and friends. Koskoff credits Marshall’s son, John Marshall, and former law clerks with filling in the blanks on his subject’s personality.

In one of the movie's many disarmingly funny scenes, Marshall tells Friedman a very personal story, admitting to losing a testicle during an accident. Of all the real-life stories Boseman heard about Marshall, this is the one that shocked him the most.

“If I told you anything else to try to be cute, I’d be lying,” he said, cracking up. “It’s that story.”

From left, Josh Gad, Boseman and Sterling K. Brown in “Marshall.” (Barry Wetcher/Open Road Films)

But some liberties were taken for entertainment purposes. Gad, who’s a go-to actor for comic relief roles, doesn’t look or act like the late Friedman did.

“Friedman was an athletic, very handsome equestrian,” said Koskoff, who had met Friedman, a fellow Connecticut lawyer, but didn’t know him well. “He was really a dignified man in a way that his character is not.”

In one scene, Friedman very flamboyantly demonstrates in court how the alleged victim could have called for help while she was gagged by tying a scarf around his mouth and screaming at the top of his lungs. That, apparently, was all real.

“People came in from the hallway,” Koskoff confirmed.

In fact, some real elements seemed so outlandish, the writers and director felt they had to change them. The juror Ms. Richmond from Richmond, for example, seemed a little too on-the-nose, so they changed her provenance to Raleigh, N.C.

But Marshall’s comedic skills were real. And why shouldn’t they be? Even great men — even the ones they make biopics about — can be funny.

“In those life or death situations, if you don’t have a sense of humor, you don’t survive,” Hudlin said. “You’d be too brittle and you’d break, right?”

“Plus,” he added, “humor is a sign of intelligence.”

Marshall (PG-13, 118 minutes). Opens Friday, Oct. 13 at local theaters.