Following in the footsteps of funnymen Jim Carrey and Will Ferrell, Steve Carell – who many people may recognize from his small but scene-stealing roles in Bruce Almighty and Anchorman: The Legend of Ron Burgundy (which coincidentally starred Carrey and Ferrell, respectively) – is finally making the transition from comedic sidekick to leading man. In Universal’s The 40 Year-Old Virgin, due out Aug. 19, Carell takes center stage as Andy Stitzer, a somewhat geeky electronics store employee who has never, in his 40 years on Earth, done the deed.

The film, from first-time feature director Judd Apatow (who served as a writer and director on many episodes of the short-lived show "Freaks and Geeks," as well as producer on Anchorman), is a hilarious, sometimes graphic look at the life of a man who, somewhere along the way, just never had sex.

"I just fell into that, really," said Carell in a recent interview with About.com, explaining how he ended up conceptualizing the idea for Virgin and co-writing (alongside Apatow) the role for himself. "I mean, I did Anchorman and Judd [Apatow] and I became friends, and he said that he wanted to direct something and was interested in pursuing something with me. I pitched him the idea for the virgin movie, which he liked, and then he took that and pitched it to Mary Parent at Universal. She liked it and it just started to snowball from there. It happened very quickly."

In the film, which also costars Catherine Keener (Being John Malkovich), Paul Rudd (The Shape of Things) and Elizabeth Banks (Seabiscuit), Carell’s Andy is a nice guy with a steady job, comfortable apartment and a small group of decent friends. It just so happens that he’s never, ever gotten around to doing it. Throughout the film, which is stamped with an R-rating for pervasive sexual content, language and drug use, Andy’s small group of friends at the electronics store where he works try to get him out of his virginal lifestyle and into the bedroom. Everyone thinks Andy’s finally going to make it happen when he meets an attractive single mom named Trish (Keener), who is genuinely interested in Andy – that is, of course, until the people in Andy’s life rooting him on learn that Andy and Trish are basing their relationship on a mutual no-sex policy.

Although Carell didn’t actually meet any 40-year-old virgins before coming up with the idea for the film, the actor – who most recently took on the part of Michael Scott in the Americanized version of British television show "The Office" – says he did read some case studies which show that there are actually a lot of people out there who, by the age of 40, have never had sex.

"So many of them are just normal people who kind of slipped through the cracks … But just not necessarily weird or phobic or having emotional problems, but just people it just never happened to," said Carell in the About.com interview. "And at some point they gave up trying. That’s kind of the crux of this character. He had a few opportunities along the way and it didn’t pan out, and at one point he just gave up trying."

Carell adds, though, that Andy – who eventually tries his hand at foreplay and seduction in the film to try and make things happen – isn’t at all broken-hearted over the fact that, at 40 years old, he’s never had sex.

"He’s just kind of shut down that side of himself and he’s just kind of turned inward in a lot of ways. He’s made a comfortable life for himself within that person, who he’s become," Carell told About.com. "And then he meets these guys and he meets a woman who helps bring him out of that. So actually the story, I think the title kind of leads people to believe it’s really an over-the-top crazy sex comedy but it’s really not. It’s actually a very sweet relationship comedy."

And Carell – judging by his last few roles (including his tiny part as Nicole Kidman’s eccentric Uncle Arthur in the recent re-imagining of Bewitched) – is no stranger to comedy. Bruce Almighty, Anchorman and "The Office" aside, Carell actually started his Hollywood career with a pretty good comedic pedigree. Although "The Daily Show" alum originally planned on attending law school, Carell shifted gears after college and moved to Chicago, where he hoped to secure a slot in the city’s highly touted Second City Comedy Troupe.

"I moved to Chicago with the hope of getting into Second City because I’d seen a Second City touring company at my college (Ohio’s Denison University), and I thought it was great and couldn’t think of anything more fun than going on the road and doing improv and sketches," said Carell in an interview with Knight Ridder Newspapers’ Luaine Lee in March. "After a year or so, I got in and worked at Second City for a few years. I did other plays and musicals in Chicago, then my wife (actress and "SNL" alum Nancy Walls) and I moved to New York from there."

Carell, who is next slated to star as Agent Maxwell Smart in the upcoming film version of "Get Smart," says his parents, despite really wanting him to be an attorney, were very supportive of his somewhat sudden career shift and resulting move to Chicago.

"They asked, ‘What do you like doing? What makes you happy?’ I said, ‘I’ve always liked acting, doing plays.’ And they said, ‘Do it. Have fun. Just try it and see where it goes,’" Carell told Lee. "They were completely supportive, maybe in the backs of their minds they were thinking, ‘Ah, in six months he’ll be back, he’ll be going to law school somewhere.’"

According to the actor, though, he was always somewhat inclined to do comedy. According to his March interview with Lee, Carell – the youngest of four boys growing up – said he would try to get reactions from his brothers’ girlfriends at the dinner table by walking in and sitting down with a foil-wrapped football helmet on his head.

"And it had one of those blinking lights from the top of a police car that I stuck on the top," he told Lee. "And I would just appear without any sort of fanfare, enter the room and sit down at my place at the table just to see what kind of response I was getting from the girlfriend."

The reaction must have been lots of laughs, as Carell, who is currently a happily married 41-year-old man with two young children and a skyrocketing movie career, is continuing to do what he loves. And comedy fans everywhere are happy about that.

The 40 Year-Old Virgin releases in theaters Aug. 19.