LOS ANGELES – He’s played a Jewish neo-Nazi, a crack-addict schoolteacher and a man who falls in love with an inflatable doll.

But suggest to Ryan Gosling, an independent-film poster child for the better part of a decade, that he chooses roles for their complexity rather than their commercial appeal and he’ll wave you aside.

“When I make these movies, I don’t think, ‘I want to make a little indie movie and I want to stay in the indie world because I think it’s cool,’” says the twinkle-eyed Canadian actor. “I make these movies and think, ‘This is the one. This one is going to be “The Blair Witch Project.”‘ I’m sure of it while we’re making it. And then it comes out and it does no business.”

It’s not clear if the 30-year-old’s latest film, “Blue Valentine,” will become a phenomenon. (Probably not.) But it’s certain to burnish his already shiny reputation for artistic purity.

The actor spent four years, on and off, shaping the character and discussing the role, one that he got so carried away with that in one scene he spontaneously climbed a fence along New York’s Manhattan Bridge and teetered 200 feet above the East River.

Written and directed by Derek Cianfrance, the harrowing romantic drama stars Gosling as the working-class, functional alcoholic Dean. Through a series of cleverly interwoven flashbacks and flash-forwards, Dean is seen falling in and out of love with wife Cindy (Michelle Williams), with whom he is raising a child.

Other actors may have played Dean in a single key, but Gosling moves fluidly among moods: torment, agitation, sweetness. As he has with many of his other characters — the neo-Nazi in “The Believer,” the teacher in “Half Nelson” (which earned him a lead actor Oscar nomination at age 26), the whimsical romantic in “Lars and the Real Girl” — Gosling is able to inspire an unlikely mixture of repulsion, fear and sympathy.

Compared to some of the exotic characters the actor has played, the Dean role feels ordinary, even pedestrian. Yet Gosling says this part is closest to his heart — precisely, he says, because it’s the stuff of everyday life.

“I feel like ‘Blue Valentine’ is the biggest dog on my porch because it’s the most universal experience: What happens when love goes away,” Gosling says, sipping a latte at a cafe, his red-and-white plaid shirt buttoned up against the evening chill. “It’s the ripple effect of that lost love, the shadow it casts.”

Born and raised in Ontario, the often mischievous-looking (and mischief-making) Gosling got his start as a Mouseketeer on the “Mickey Mouse Club” alongside Britney Spears and Justin Timberlake. Dropping out of high school, he cut his teeth on television shows like “Young Hercules” before becoming an indie sensation with “The Believer” in 2001 and a mainstream heartthrob in 2004’s “The Notebook.”

While “Notebook” concerned love at its most requited, Gosling has more often been interested in romance of the tormented variety (or in the case of “Lars,” the demented variety). It’s a subject he says has fascinated him because he’s seen how affection can turn to disgust despite so many good intentions.

“There’s something I often see in people who’ve been married — a deep undercurrent of resentment toward the other person because they need them,” he said.

To tap into the brokenheartedness at the center of “Blue Valentine,” Gosling looked at his own relationships (he dated “Notebook” costar Rachel McAdams), at his parents, at his coupled friends. He recalled how a pair of married friends argued, before they divorced, about the correct way to wash dishes.

“You could tell these were people who didn’t know how to address the bigger problems in their relationship,” he said. “People are fighting about these things that are not really what they’re fighting about.”

Although “Blue Valentine” is a prototypically independent movie — a budget of just over $1 million, more than 60 screenplay drafts — it has managed, like much of Gosling’s work, to achieve a pop-cultural and critical heft that exceeds its evident commercial potential. A hit at the 2010 Sundance and Cannes film festivals, the movie briefly became a culture war flashpoint when the Motion Picture Assn. of America gave it an NC-17 rating for an oral sex scene. (The rating was later changed to an R on appeal.)

Much of the film’s buzz centers on its emotional grittiness, which arose in part from extensive preparation by Gosling and Williams. Cianfrance had the pair live together in the same house as they honed their characters. They walked their dog, cooked and made home videos, all to create a more plausible marital environment (that they could then puncture in the film).

Since Dean works as a mover, Gosling got hired by a moving company. Cianfrance said he expected him to carry a few boxes ; Gosling bonded with the movers and worked all day.

A willingness to plunge in headlong is a Gosling trademark. “Ryan doesn’t really know how to ride a skateboard,” Cianfrance says, describing his star’s persistence. “But he doesn’t know that. So it’s fun to watch him try to do a trick.”

If the actor has a serious, save-the-world side — he recently returned from the Congo, where he shot documentary shorts for the storytelling website MediaStorm.com — Gosling’s default mode is that of the wiseguy. He’s prone to baiting his producers and directors by making fun of everything from their e-mail sign-offs to their cooking quirks.

Director Andrew Jarecki, who worked with Gosling on his recent “All Good Things,” says that while the actor’s motivations may be instinctual, he is uncommonly analytical on the set. Unlike many actors, Gosling watches himself on a monitor between takes and keeps a director off balance by trying wildly different interpretations of the same scene, offering opinions as he goes.

Next up for Gosling is another marital-crisis film, but this time it’s a comedy: the Steve Carell movie “Crazy, Stupid, Love,” slated for release this summer by Warner Bros.

“I don’t want to play the same note,” Gosling said of making a studio comedy for the first time.

But though it sounds like Gosling may be contemplating a switch to bigger productions, the shift will probably only go so far. He is, after all, still Ryan Gosling.

“I just have this total fantasy that you can make a movie like ‘Blue Valentine’ and that it can be as big as ‘Avatar,’” he said. “That’s my dream. I don’t have kids or something else more important in my life right now so I keep hammering away at it. I haven’t done it yet. But I think I’m getting closer.”