Nathan Fillion, right, with Tom Lenk, plays the not-too-bright Dogberry in Joss Whedon’s “Much Ado About Nothing.”

Nathan Fillion was pretty sure he had made a mistake.

The “Castle” actor signed up to play malapropism-prone law-enforcement officer Dogberry in the spectacularly fun adaptation of Shakespeare’s “Much Ado About Nothing,” opening Friday, because Joss Whedon asked him. The film, which was shot in one month on a shoestring budget at the director’s house, stars many of theactors who show up repeatedly in Whedon’s projects (Fillion starred in “Firefly” and the Web series “Dr. Horrible’s Sing-Along Blog” and appeared on “Buffy the Vampire Slayer”).

What Fillion hadn’t counted on was the dialogue.

“I can memorize a script so easily, so quickly. Thank God for my soap training back in the day,” says Fillion, who appeared on the soap opera “One Life to Live.” But here, “I had so much difficulty, and I was getting so frustrated.”

It was mom to the rescue. “My mom was my 11th-grade English teacher, and she would labor over every line, defining words for us, talking about references, and what that meant at the time, and why it was a big deal. When I stopped trying to memorize Shakespeare and I started trying to understand it, that’s when it turned for me.”

The trick to playing Dogberry, Fillion says, lies in the character’s complete lack of self-awareness (a trait that echoes his performance as the lunkheaded Captain Hammer in “Dr. Horrible”). “He’s not bright, and that’s important,” he says. “But he thinks he is, and that’s more important.”

All of the laughs the character gets — and there are many — come from Dogberry’s super-serious air and how it contrasts with his ridiculous turns of phrase. That earnestness is the key to comedy, Fillion says.

“There’s nothing more painful to watch than someone trying to be funny. It’s desperate. It’s awful,” he says. “[Dogberry] isn’t being clever, he’s being truthful. In Dogberry’s case, he is unaware that he is being laughed at. He’s invulnerable. He’s protected by his own stupidity.”