Mila Kunis and Justin Timberlake – the stars of Friends with Benefits – say Woody Harrelson's gay role in the film was extremely important.

In the film, Harrelson plays Tommy, a non-stereotypical gay guy and the best friend of Dylan, played by Timberlake. Dylan and Jamie (Kunis) decide to scrap romance and add sex to their friendship, which inevitably leads to complications.

“That character [Tommy] was not originally in the script,” Timberlake said during a press junket, male gay entertainment website reported.

“And I'm really glad you brought it up, because it's something that was very important to [Director] Will [Gluck] and myself. And Mila.”

“We wanted to use that opportunity to break ridiculous stereotypes about sexual preference,” he said.

“And about the relationship between a straight man and a gay man,” Kunis added.

Timberlake went on to say that he and Gluck have a lot of gay male friends.

“And you know, I get along with them the same way, and I wanted that to come from an honest place from my own friendships with men who have a different sexual preference than I do,” Timberlake said. “We both saw it as a great opportunity to sort of … break a stereotype of what people have – [which] to me, has kind of become insulting – about what a gay man might be.”

In a trailer for the film, Tommy comes across as a cocky manizer: he mimes behind a man's back a milking gesture and tells Dylan at a party, “You know what else is awesome: the beer can on that dude. I am going to shotgun that shit tonight.” (The trailer is embedded in the right panel of this page.)

Friends with Benefits opens nationwide on July 22.