Ludicrous, filthy and hilarious, “The Little Hours” is a wonderfully preposterous ensemble comedy set in the Middle Ages and based loosely on Boccaccio’s “The Decameron.” A great cast that includes Nick Offerman in an auburn pageboy wig, Aubrey Plaza and Alison Brie delivers both deadpan giggles and laugh-out-loud lunacy in this story of a sexy young man (Dave Franco) let loose in a convent.

A long opening scene featuring Plaza as a nun grimly trudging through a forest with a donkey seems to play it straight as an authentic period movie, in both costume and soundtrack. Soon, however, the convent’s handyman greets her leeringly, and a stream of contemporary profanity flies from her mouth. This juxtaposition is the basis for lots of the jokes, but the script is more than just that gag. The nuns are petty and jealous, griping and tattling, especially complaining about a spoiled nun (Brie) whose father bankrolls the convent.

However, when Brie meets with that father (Paul Reiser) we learn how miserable she is, despite her spacious bedroom, as she waits in the convent for her father to cough up a dowry so she can wed as her sisters did. Brie brings actual emotion to some of her scenes, making the ensuing farce that much better.

Meanwhile, we are treated to the sight of Offerman as a wealthy blowhard presiding over his dinner table while his wife (Laura Weedman) winks and flirts with a suspiciously handsome servant (Franco). Their affair is, predictably, uncovered and Franco must run for his life. He meets the drunken, hapless Father Tommasso (John C. Reilly), and soon the two come up with a plan to hide Franco at the convent, where he shall pretend to be a deaf mute in order to keep a low profile.

One of the best scenes is when Father Tommasso is treated to the details of Franco’s sex life, which he recounts in an earnest confession. The hungover, deadpan Tommasso learns a few things, and his face while listening is absolutely priceless. While the young man plans to put that lifestyle behind him, the lusty young nuns have other plans as soon as they lay eyes on him.

What works best is that “The Little Hours” is a mix of ridiculous sex jokes and low-key moments of subtle silliness. Kate Micucci rounds out the trio of nuns as a mousy, put upon whiner, and her explaining to Brie that washing her habit involves leaving it soaking in ash for four days is as much of a giggle as the three frustrated nuns beating up a man with a bunch of turnips, screeching obscenities all the while.

The medieval setting almost brings to mind (I said “almost,” don’t freak out!) “Monty Python and the Holy Grail.” It’s unlikely that “The Little Hours” will reach that level of devoted acclaim, but the irony inherent in recognizable, extremely contemporary comedians behaving in modern ways while living in the Middle Ages is a key to the appeal of both films. You can laugh knowingly at some of the more sophisticated humor, or laugh out loud at Dave Franco’s face, which is perfectly handsome yet somehow funny looking, as he resists and succumbs simultaneously to a memorable variety of aggressive advances from the unleashed nuns.

Some of the most mordantly hilarious comedians working on screen make “The Little Hours” an outlandish, bawdy farce worth watching. It is utterly silly and totally foul, but if you can see that as a positive, you will appreciate this deranged medieval romp.

“The Little Hours” is currently available to rent and to stream for free on Hoopla, a free streaming service from the Mobile Public Library.