Tour de Pharmacy on HBOFirst, there was 7 Days in Hell." Now, he's shifting into a new gear by focusing a satiric lens on the world of cycling -- and the illegal doping that's long dogged it -- in "Tour de Pharmacy."

As star and executive producer, Samberg once again had a hand in every aspect of how the film came together, assembling an all-star assortment of sly comedic talents -- including Will Forte, Maya Rudolph, Daveed Diggs, and Jeff Goldblum -- with a roster of straight-faced dramatists -- Freddie Highmore, Orlando Bloom, James Marsden, Kevin Bacon, and Julia Ormond among them -- and an elite group of sports pros, like John Cena, Mike Tyson, Joe Buck, and even cycling's fallen hero Lance Armstrong, to lampoon one of the world's most popular and frequently controversial athletic competitions, the Tour de France.

Samberg, who has a starring role as the obliviously privileged, inept, and unrepresentative Nigerian cyclist, takes Moviefone inside the creation of a sports-doc sendup, including merging the classic root-for-the-underdog structure with improvisational spirit, which wasn't as easy as riding a bicycle -- nor, for that matter, was riding a bicycle.

Moviefone: Of all the niche sports to delve into, why was the cycling world the one that you found funny and fun to explore on a comedic level?

Andy Samberg: The combination of the look, all the spandex, and also the fun of the early '80s, both in terms of the way that we would style the world and the way we would shoot it. Also just the sort of long history of the various behavior surrounding the sport, seemed like a fun place to take reality and explode it even further.

Did you have any special affinity for the sport beforehand, or did you just know as much as the average person who casually follows sports?

I think more the latter. Murray Miller, who's my co-EP and the writer on it, he knew a little more. We did a bunch of research, and read about the history of the Tour de France and cycling and stuff, and that informed a lot of the bits that we tried.

But yeah, it wasn't like the first one, "7 Days in Hell," where we were both avid tennis fans. This one was more like, we knew about the tour, and we knew about cycling, and we thought it was cool that it wasn't, like, our favorite sport. We just thought it would be a fun one to do.

Tell me about the process of digging into the research. I imagine not many comedy projects require a lot of research, but I bet it was kind of fun to dig into the history and the era in particular.

It was. Just learning about the intensity of the competitiveness of it, stuff like chasing the badger, and all that. Also, looking all the way back and realizing that cheating was so engrained in the sport -- like, if you read back far enough, the very first time they did a tour, a lot of the cyclists were, like, drinking booze and stuff to try and deal with the pain, because it's actually just an impossible event.

There is a story about one cyclist who left the race, got on a train and then rejoined the race down the line. Which we had in one of the versions of the script, and we're like, "It's actually too unbelievable." It supposedly happened, but who knows?

How tightly do you guys script everything, and how much room do you leave for everybody to play around when you're shooting?

We script it pretty tightly, with the knowledge that we're going to try a ton of alts when we're shooting. So all the premises of the big structured bits and style choice stuff is in place, and then a lot of the times with the talking heads interviews then we play around more.

So we'll be like, "Okay, we've got an hour with Jeff Goldblum next week. Let's write a ton of alt lines that we could possibly use throughout the story," and then once we're on set, we also will then throw like 50 new lines out at him and see what feels funny. Then we'll sift through it all.

This is as deep a bench of players as it gets. How do you get all these people involved? I imagine you have to be pretty creative in the editing to make everybody look like they're in the same room at some time.

Yeah. Our primary five riders were all there most of the time together, so that was great. Me, John Cena, Freddie Highmore, Orlando Bloom, and Daveed Diggs -- and [James] Marsden, for the most part. So we kind of shot all of that in a big chunk all in a row. Then we sort of picked up talking heads and weird sidebar stuff, like the Finnish credit card commercial and stuff like that on different days when people were available.

Because of that, we're able to get a ton of really awesome people, because you've just got to find an hour or two here or there that they could do it. But on the other hand, it makes production stretch for a really long time.

Is everybody involved sort of in your professional circle in some way? Or do you have to invite total strangers, and say, "This is going to be fun -- just trust me."

Definitely the latter on some of it. Obviously, people like Will Forte and Maya [Rudolph] I already knew. J.J. Abrams I was already somewhat friendly with. Then there's people like Orlando, who I never really met before, but I thought he would be super funny for it. We just call him up and say, "What do you think?" And "Trust me" [Laughs]

I imagine "trust me" was used a lot in landing Lance Armstrong.

I did say, "Trust me," but I also felt like we were wholly transparent with Lance. He knew what the joke that we wanted to do with him was, and we sent him the script, and I explained it to him even further when we talked on the phone. He thought it was funny. He was like, "Yeah, f*ck it. Why not? Let's try it." And it turned out really good. He really went for it. I was very pleased with his stuff. It's been making people laugh in the screenings we've had so far.

Tell me about the lessons that you learned making "7 Days in Hell" that you were able to carry over here.

Something we learned on "7 Days in Hell" and also learned even more when I was working with Akiva [Schaffer] and Jorma [Taccone] on "Popstar," was that when you make a mockumentary, you can definitely shift and adjust how you're telling your story as you're editing by just picking up new talking heads, or like adding a little piece of fake news footage.

You don't have to be completely tied to the script if it's not clear enough, or if it's not playing how you feel like it should be playing. You can make adjustments and add stuff after the fact, sort of streamline things, and it helps you also cut things that aren't necessarily working to your liking, which is nice.

Both of these films really pick up on the narrative of the "30 for 30" style. Are you a big fan of sports documentaries? Is that something that you've absorbed a lot of?

Absolutely. Murray and I both love them. I think I've watched pretty much every "30 for 30." When we went into it, the thing we said to each other was like, "Man, how cool would it be to do a comedy '30 for 30' or HBO Sports Presents kind of a thing? Then we can sort of move around and tell different stories with it." Hopefully, this one will go over well, and we can just keep making more.

I was impressed with how you're able to go really far out with the comedy and get into some adventurous, absurdist territory, but you still have a narrative that works. Do you have a sense of how you guys pull that off?

Thank you. I'm glad you think that, because we worked hard. I think one of the things that was appealing to us was about doing these things is the reason those "30 for 30s" work so well, and the reason sports comedy movies, and sports drama movies work so well, is they have that great built-in dramatic structure, where you're like, I know this is an event, it's going to happen, and there are stakes, and there's going to be a winner and a loser.

I'm interested in that. There's all these tricks to how you edit it and put it together now that really hook you and keep your interest. I can't turn on a "30 for 30" without wanting to know what happens at the end. Even if I already know what happens at the end, because it's based on real life or something I watched when it actually happened, I'm like, "Oh yeah, I want to relive that, to hear everyone's take on what happened."

And then you also have a sports movie structure of more straightforward comedies that came out, like your "Happy Gilmore"-type movies that have the same thing, where I'm like, "I love 'Happy Gilmore,' not just because it's super funny, but because I also, every time I watch it I'm like, come on, Happy, you've got to beat Shooter! He doesn't deserve to win. He's a bad guy!"

You get sucked into the sports drama of it, for the same reason that I get sucked into real sports drama in real life, where I'm like, "Man, I sure hope my team wins." Yeah, that's a big part of why it's appealing from a storytelling perspective.

You guys had to do everything while on bicycles. Was that ever a particular challenge for the actors?

It was a great challenge for myself. Orlando Bloom and James Marsden are both like basically professional cyclists. They do it in their free time, and are great at it. Then Freddie, and Daveed, and John Cena are all very athletic and coordinated. Then I also was a part of it, and I was not good.

Luckily we wrote my character so it kind of made sense. But yeah, it was tough. And we were shooting in, like, 120 degree heat a couple of days. So it definitely was a tough thing to do.

Are you already back to work on the next season of "Brooklyn Nine-Nine," or are you still waiting to get back to set?

The writers are back, and we start shooting again, I think, at the end of July. So I'm on a little bit of a break right now, which is nice. But we're excited to come back. I've already heard a bunch about next season and it sounds good.

It's great how you guys leave everything so ripe at the end of a season, cliffhanger-y. Did you guys already know where you were going to go with the results of Jake's verdict, or did you just leave it and say, "Okay, we'll think about it over the summer and come back"?

Dan Goor would have to answer that question. Per my conversations with him, it was kind of a little bit of both, where it was like, "We have an idea of where we're going to take it, but it's not written in stone, necessarily. Let's air it and see how we feel." The direction that it's headed in is what I think we all thought it was going to be, and it sounds pretty good. The stuff he's told me so far sounds really cool and funny.

What's the most out-there, niche sport that you're finding yourself really attracted to? Like, "How can we make a story around this oddball sport?"

Good question. It's interesting, because the big ones are actually the hardest, too, because of budget. It's like, "Man, it'd be fun to do basketball, or football, or soccer, or something," but then it's like, "How the hell would we shoot that?" It's so massive, and there's so many people involved, and that kind of thing.

So in terms of niche, I don't know if there is one that's too niche. I don't want to say necessarily any, because we've been talking about which ones to do next. We're definitely going to try and do one pretty quick if we can. Do you have any ideas?

Competitive eating is the first thing that comes to mind.

Oh sh*t, that's a good idea! We'll give you a "thank you" in the credits if the next one is competitive eating.