IN THE new movie Celeste and Jesse Forever, American comic Andy Samberg does what you wouldn't expect from him. The film contains a parody of a raunchy pop song, sung by Emma Roberts' teenage vixen, which is the specialty of the Lonely Island, the comedy trio fronted by Samberg that has kept YouTube's servers humming in the past few years with the likes of Dick in a Box, I'm on a Boat and I Just Had Sex. Yet he is not among the credited composers.

Instead Samberg, who has just finished seven years on the US sketch-comedy television institution Saturday Night Live, plays the titular male lead, Jesse, who remains best friends with his former wife Celeste (Rashida Jones) after the Los Angeles residents divorce, before circumstances slowly but steadily tear them apart. The film is a romantic comedy that's just as interested in loneliness and drama, which hardly matches Samberg's goofy profile.

''It was a leap of faith on everyone's part to put me in the role,'' Samberg says. ''I felt it was something that I could pull off, but as I was doing it I was really unsure. The main difference between this movie and the other things I've done is that it was a lot less work. I would hold back a lot, make everything smaller, just act as if it was real life and not be insane and over the top.''

Celeste and Jesse Forever was written by Jones, who is best known for television sitcoms such as Parks and Recreation, and Will McCormack, a fellow actor who in the movie plays the couple's affable marijuana dealer.

They were offered large sums for their much-admired screenplay, on the proviso that established movie stars would play the central couple, but they refused and, with director Lee Toland Krieger, eventually made the picture on a small independent budget.

''Rashida and I have been friends since 2005, and she knows that I'm also a writer and sent me the script as a friend to let her know what I think. I read it and told her that I thought I should be in it - that was my notes,'' Samberg says.

''As it came together I would ask - through my agent so it wasn't creepy - what was happening with the film. It had comedy and serious elements that I thought I could pull off in an honest way.''

The movie doesn't just get laughs from the fine comic rapport between Celeste and Jesse, it shows how the characters are using familiar routines and favourite punchlines to avoid the deeper issues that eventually betray them. That high level of observation was valued by Samberg, a boyish 34-year-old who has spent most of his career rapping badly, wearing a ludicrous wig or a combination of the two.

''The most exciting thing for Rashida and I was trying things we hadn't got to do on-screen before,'' says Samberg, whose recent roles have also included an obscure BBC comedy series titled Cuckoo and a starring role alongside one of his comic influences, Adam Sandler, in That's My Boy. ''The philosophy I have is to care less about what it is in terms of career building and instead just respond to the material I like and let the chips fall as they may.''

Besides, it is hard to successfully send up pop songs when they keep appropriating the very qualities you consider satirical. By the time 2011's Turtleneck & Chain, the second Lonely Island album, was released, Latin pop star Enrique Iglesias was putting out a single titled Tonight (I'm F---ing You).

''It could have been one of our songs,'' Samberg says. ''The line between what's fake and what's real is getting very, very blurred.''