Lars and the Real Girl is a sweet, soulfully acted fairy tale about a social misfit and the town that loves him. Director Craig Gillespie (Mr. Woodcock) and a gifted cast treat Nancy Oliver’s delicate screenplay with the same respect the characters treat Lars’ unusual new girlfriend, and therein lies the charm. What could have been cloying or absurd is instead endearing, even if the film is somewhat too long for its conceit.

Holding the film together is Ryan Gosling’s remarkable ability to give an introverted, delusional character charisma. As evidenced in his complex portrayal of the anguished teacher in Half Nelson, as well as in earlier films, Gosling disappears into his roles. His performance as Lars, a severely shy, child-like man living in the garage apartment behind his brother’s house in a wintery Midwestern town, is subtle, surprising and tremendously affecting.

In the film’s opening sequence, Lars is shown plaintively looking out his window at the woman next door, who soon clumps over in snow boots and entreats him to come over for a meal. We soon learn this possible love interest is his pregnant sister-in-law, Karin (the marvelous Emily Mortimer), who eventually must literally ambush and tackle him to get him to dinner. Is Karin the real girl or will it be Margo (Kelli Garner), an awkward yet appealing young woman who works in the same office as Lars?

Gus (Paul Schneider), Lars’ rather gruff older brother, assures Karin that Lars is just fine, and is even more confident of his assessment when Lars happily tells them he’s met a girl online. Lars asks if they’d mind letting her stay with them, because she’s religious, and then explains that she doesn’t speak much English and needs a wheelchair. They’re thrilled, until they meet her. It turns out she is the RealGirl, a custom-ordered “fiancée in a box,” life-size and anatomically correct. Though dressed like a stripper, Bianca is actually a half-Danish, half-Brazilian missionary “on sabbatical to experience the world.” Lars is clearly in love and Gus and Karin are dumbfounded.

Gillespie is especially successful in setting up the premise, finding the humor and pathos in it. And when the shock and weirdness wear off for the family, townsfolk and the audience, Lars and the Real Girl manages to make us believe that with acceptance, compassion and love, everything will work out. But the film doesn’t shy away from depicting the pain and humiliation accompanying mental illness. Gus and Karin experience their share of confusion, disgust and self-recrimination. When they consult the local doctor, Dagmar (Patricia Clarkson), who also happens to be a darn good psychologist, she warns them that people will laugh at both Lars and them. And they do at first, but the magical part of the story is how quickly everybody comes to accept Bianca and integrate her into the community. This town makes It’s a Wonderful Life look dystopian. Dagmar’s analysis might seem a little pat, but not Clarkson’s performance. Like Judd Hirsch in Ordinary People, she’s the soul of reason, and her scenes with Gosling are among the film’s best.

But Lars and the Real Girl belongs to Gosling, whose daffy rendition of “Love,” sung in two registers from a tree house to Bianca below, and whose quiet dance alone at a party to Talking Heads’ “This Must Be the Place” encapsulate the spirit of this offbeat, oddly upbeat film.