In the make-believe world of The Invention of Lying, everyone strictly obeys God’s ninth commandment. Alas, in spinning this ambitious morality play, the filmmakers violate a screenwriting commandment: thou shalt not get cold feet in the third act.

The characters are truthful not because they want to be; they just don’t know any better. Their DNA doesn’t permit them to lie to their spouses, call in sick when they’re feeling fine or tell their children that Santa is real. Of course, this also means they can’t fudge the truth to spare others’ feelings.

This brutal honesty makes for a very funny first hour. We meet Mark Bellison (Ricky Gervais), a chubby writer whose job with Lecture Films Motion Picture Studios is in jeopardy because his truth-and-only-the-truth scripts are so boring. (The movies here are just narrators reading dry facts to the audience.) Mark is smitten with the beautiful Anna Mc Doogles (Jennifer Garner), who would never dream of getting seriously involved with such a genetic loser but agrees to go out with him as a favor to her cousin, Mark’s best friend (the comedian Louis C. K.).

This first date is hilarious, as we are immersed in a world without tact. (Anna apologizes for being slow to answer the door, explaining that she was busy masturbating.) This scene—including dinner, where the waiter talks about the meaninglessness of his existence—sets a perfect tone for the rest of the film’s expository section. We meet Mark’s loser friends, suicidal neighbor (Jonah Hill), timid boss (Jeffrey Tambor), snarky secretary (Tina Fey) and handsome and obnoxious office archrival (Rob Lowe). These archetypal characters are wittier than usual because they express their contempt for Mark openly but without malice.

The worm turns one afternoon when Mark realizes that he doesn’t have to tell the truth. Under pressure to pay his rent, he lies—and just like that, the ethical floodgates are opened. Since Mark is the only one who even grasps the concept of a lie, others believe everything he says, which quickly works to his advantage. He has some qualms about being dishonest, but not enough to stop—an ambivalence that the very funny Gervais pulls off with aplomb.

Things get more complicated when Mark finds himself in a hospital room with his dying mother (the wonderful Fionnula Flanagan), who is afraid to face an eternity of nothingness. To ease her mind, Mark makes up a story about a wonderful place where she will be happy and content. But his tale is overheard, and he’s an instant celebrity. Under pressure to explain himself, Mark tells the world that he knows all this because he talked to “the man in the sky,” which leads to a terrific scene in front of his house—a suburban Sermon on the Mount in which Mark must field a barrage of complex questions about who gets to go to heaven and why.

And then the film abandons its huge potential for being a study of the vagaries of lying, the power of fiction, the importance of mythmaking and the nature of good and evil. It opts instead for a standard-issue conclusion about the good guy getting the girl. Some bad endings happen because of studio interference; sometimes the writers themselves don’t know how to wrap up the story. Whatever the reason, this one is especially disappointing because smart romantic comedies are rare, and you hate to see such a beauty reduced to roadkill in front of your eyes.