Being friends with Bill Murray has had some drawbacks for Mitch Glazer. Since the former SNL MVP, poetry aficionado and part-time party crasher doesn’t have an agent or a manager, total strangers call Glazer up to see if he will convince the man to be in their movies. And it also means that Murray calls him up whenever Road House is on TV, to deliver a play-by-play commentary on the scene where Patrick Swayze has sex with Kelly Lynch (Glazer’s wife). But it also means that the writer-director gets to make crazy dreams come true — like, say, the idea that Murray should star in a movie as a washed-up rock promoter who gets stranded in Afghanistan when his client flees a USO tour. The result is Rock the Kasbah, Glazer and director Barry Levinson’s comedy which opens this Friday.

“It was everything I’ve ever wanted to see him do, including sing ‘Smoke on the Water’ to Pashtun tribesmen,” Glazer says. “The genesis of it was when Bill had done, I think, Broken Flowers. His acting was so powerful and minimal, but it wasn’t every arrow in his quiver. And then I had a conversation with him, and he’d been talking to a mutual friend, [film critic] Elvis Mitchell, about exactly the same thing: Maybe it was time for him to do something funnier, but was also about something and had heart to it. I’ve been writing for Bill’s voice since 1987. I know what he likes and how he sounds and how he reacts — so when he gets the script, he thinks he’s improvised it, which is the ultimate compliment.”

Before becoming a Hollywood mover and shaker, Glazer started off as a rock journalist: He wrote features for Rolling Stone in the early Eighties on Roman Polanski and Peter Sellers. That background informs the casual insider tone of Kasbah, whether Murray’s character, Richie Lanz, is talking about working with Eddie Money back when he was still Eddie Mahoney, or spinning a tale about convincing Stevie Nicks to go onstage. “I’m a complete rock & roll relic,” Glazer confesses. “There are times [when] I looked at Bill, and he had let his hair grow long, he was wearing a denim shirt and he had these turquoise beads on — and I wondered: Is he making fun of me?”

The script was finished seven years ago, but it kept running into studio resistance: a comedy set in Afghanistan made executives nervous, even before ISIS started beheading people. But eventually the movie got a green light and Levinson came on board to direct it, with a minimal $15 million budget and a shooting schedule of just 29 days. Calling from his lunch break on the set of an HBO movie starring Robert De Niro, Levinson says (after apologizing for having a mouthful of ribs), “Some directors are really smart about the business. One director told me, ‘You don’t want to make an inexpensive movie — you want to spend so much money that the studio has to spend a lot of cash to get back their money.’ That’s true, but [then] what movie would I be making that I would care about?”

Related

With Levinson and Murray committed, some major talent signed on, including Zooey Deschanel (as the client who goes AWOL), Kate Hudson (as a “hooker with an ass of gold,” as Glazer’s script described her), Danny McBride (as a low-level arms dealer), and in the crucial role of a young Afghan woman with a dream of appearing on Afghan Star (her nation’s version of American Idol), Palestinian actress Leem Lubany.

Bruce Willis also came on board as a tough-as-nails American mercenary with dreams of writing a bestselling memoir. Willis and Murray had acted together before, in Wes Anderson’s Moonrise Kingdom, but their connection went back much further than that: The Die Hard star was an NBC page when Murray was a star on Saturday Night Live, and has said that when he wore the blue blazer, Murray and Gilda Radner were the only two NBC personalities who treated him like a human being. Their rapport is one of the best things about Rock the Kasbah; for example, a passing reference in the screenplay to romance novelist Danielle Steel led to an improvised conversation between the two of them about Richie Lanz’s romantic history with her.

“For most of my life, The Razor’s Edge was the coolest job I had,” Murray told us last year, judging his movie roles by where they filmed (that 1984 drama shot in both Paris and India). “I went three decades before I had another job like that.” But Rock the Kasbah filmed on location in Morocco. “It was great working in Morocco, where my phone didn’t work,” Murray said. “That was living: there was no Internet service in the desert. And so I had a very good time just focusing on the job, and I think we did unbelievable work.”

Murray being Murray, he didn’t just work, of course. One day during the shoot, while the lighting crew was at work setting up a shot, Levinson joined the star on one of his walkabout expeditions: strolling through crowds, wandering into bars, exploring a new city. The director mentioned living in L.A., to which Murray replied, “No, it’s not for me.” When Levinson asked why, the actor said, “I need to be somewhere where I can just bump into things.”

On weekends, Bill would gather a crowd (including two of his six sons, a nanny, Glazer, and Lynch) and head out on Moroccan road trips. One favorite destination: the beach town of Essaouira. “It’s apparently where Jimi Hendrix wrote ‘Castles Made of Sand,’ or that’s the legend,” Glazer says. “And it’s beautiful: camels on the beach. We’d all be singing on the bus, and it was like summer vacation.” They also visited the Medina in Fez, a dizzyingly crowded bazaar. “He would just dive into the middle of it as if he knew where the hell he was,” Glazer says. “There are locals still wandering around looking for ways to get out of the Medina. You want to turn around and retrace your steps, and that’s when Bill goes deeper. Saying he made the most of it is putting it too mildly.”