Prudery and pleasure, repression and release. “Hysteria,” the Victorian-era romantic comedy, is awash in such conflict. Set in 1880s London, it’s the tale — inspired by historical, if not hysterical, fact — of the invention of the vibrator. And Hugh Dancy, who stars as a young doctor who joins a practice specializing in curing women of their anxieties and afflictions by tending to their “gentle areas,” wasn’t exactly sure what he was getting into.

“It is true that there were moments when we would stop and look at each other and silently telegraph the thought ‘What the hell are we doing? How did this happen?”‘ says the actor, referring to the scenes in which he and Jonathan Pryce, as his colleague and mentor, are in their office, bringing various patients suffering from “female hysteria” — a once-common diagnosis — to orgasm.

“Then again,” Dancy says, laughing, “I think in a way that’s what drew me to the project: In a slightly masochistic fashion, it’s the idea of the number of ways that it could have gone so radically wrong. … The movie walks a fine line between all of these different things. I could imagine a very serious, socially realistic version of this story, and then just a kind of gross, out-and-out sex comedy version. …

“And actually, it’s really a very sweet, funny movie, and it’s innocent as well. And I thought that was my job, really: playing that character and to try to get all these different things working together. …

“I suppose what we needed to do was tap into people’s awareness of those Merchant-Ivory movies, of those costume dramas, of those adaptations, and make them feel, ‘Oh, OK, I recognize where I am,’ and then subvert it with the fact that Jonathan and I are doing this frankly semi-obscene thing for a living! You want to be able to have your comedy, but without jolting people out of that period too much, because that’s where the joke comes from.”

Dancy, the Oxford-educated son of a philosopher and a publisher, likens his role — Mortimer Granville, physician and idealist — to that of another 19th-century character he’s played: David Copperfield, in the 2000 Hallmark television adaptation of the Dickens classic.

“David Copperfield is a bit like this,” the actor explains. “You’ve got one pretty straightforward, young, heartfelt protagonist at the center, and then all of these wacky characters, these great Dickensian caricatures, all around him. And if you’re not careful, as that central character, you can just kind of get lost, because you’re the still-point in the middle of this storm of eccentricity. So I was trying to find a way to unite the whole thing, and actually have a character to play at the same time.”

This he does. Directed by Tanya Wexler, from a screenplay by Stephen and Jonah Lisa Dyer (and based on a story idea by Philadelphia Daily News columnist Howard Gensler), “Hysteria” also stars Rupert Everett (a wealthy, eccentric inventor), Felicity Jones (the bright, beautiful goody-two-shoes daughter of the doctor played by Pryce) and Maggie Gyllenhaal. She’s Charlotte, a firecracker feminist who runs a hospice for the poor and who runs afoul of the moral and social arbiters of the day.

Dancy’s Mortimer and Gyllenhaal’s Charlotte, of course, are fated for each other.

“When I read the screenplay” Dancy recalls, “Jonathan had already signed up, Rupert had signed up, and Maggie was circling it, and all of those things were a big part of the incentive for me. Particularly Maggie, because that character, she does such a different thing in the movie. She had to really nail it. … She’s a little bit more contemporary, she’s forceful and she has conviction — and Maggie has all of that, and humor, too.”

Dancy, who is married to the actress Claire Danes, is currently on Broadway in “Venus In Fur,” the two-character piece in which he plays a theater director casting an actress for his new play. Nina Arianda is the aspiring star who, at first, is compliant, submissive, but by the audition’s end is in full control of the relationship. Dancy and Arianda began the play in October. It closes today. The play, by David Ives, and Arianda were nominated for Tony Awards.

Next up for Dancy is an NBC series, “Hannibal,” based on the serial killer canon by Thomas Harris. Dancy will play special agent Will Graham, who goes after the supergenius sociopath Hannibal Lecter. Both William Peterson (in Manhunter) and Edward Norton (in Red Dragon) have played Graham before. Shooting starts in August, with plans to premiere the series next year in a midseason slot.

“I think the ambition is to work our way through all of Thomas Harris’ novels relating to Hannibal Lecter,” Dancy says. “We start with ‘Red Dragon,’ but actually we start before that because ‘Red Dragon’ has a lot of backstory, so we start years before. …”

Bryan Fuller, the creator of “Pushing Daisies” and “Dead Like Me,” is the writer and producer of “Hannibal.”

“It seems like really interesting stuff if we get it right,” Dancy says. “So watch this space.”