“When he walked through that lobby, he could have sucked in his gut,” writer-director Richard Shepard said during a recent visit to Texas. “And he didn’t. And I think it’s maybe symbolic of his whole performance that he just let it hang out.”

Shepard was talking about one of Pierce Brosnan’s most memorable scenes in Shepard’s film “The Matador,” in which the actor stomps through a hotel in only boots and an ultra-tight brief on his way to the swimming pool. The former Agent 007 plays a dissolute, world-weary, psychologically troubled hit-man who links up with an amiable Denver businessman (Greg Kinnear) during a chance meeting in Mexico City. The two men develop an odd-couple friendship that may or may not involve a collaboration in murder. “This character is clearly sort of James Bond on his worst day,” Shepard said of Brosnan’s Julian Noble. “And while we never really talked about it, I think the audience hopefully will enjoy the movie on its own merits as well as being a little bit of a commentary about these characters he’s played.”

The Mexican capital was an integral element in Shepard’s fashioning of “The Matador” script, which he originally intended to make, like his previous films, as a low-budget picture on a very modest budget. He’d previously made a little movie titled “Mexico City,” which he described as “basically a dark, dark thriller in Mexico City, about how dangerous it was and all that stuff. And as we were shooting it, I realized that Mexico City is really an amazing city, and this thriller I was in the middle of shooting, I realized, was completely wrong, because it’s such a vibrant, interesting city. So when I was done, I vowed to write another movie set there and try and at least get it a little more correct. And so it was really beautiful that I was able to go back again and this time present Mexico City in a way that’s closer to the way it is.”

Shepard described the writing of the screenplay, which takes lots of unexpected turns, as a departure for him. “This is the first thing I’ve written where I didn’t know where the story was going,” he said. “I didn’t know how the story was going to end. And every time I felt the script should take a right turn, I purposely made it take a left turn. I was forcing myself to keep the story as fresh as possible. We don’t have any car chases in the movie. If there’s tension, it’s really the audience not quite feeling comfortable enough to know what happened. And I like that most audiences don’t see the real ending coming. It’s the fun of it. There are so many movies now, a lot of them fall into a pattern. You know exactly where it’s going to go. And here’s a movie–yes, Greg and Pierce are big movie stars, but it’s not immediately a slam-dunk guaranteed to be number one at the boxoffice sort of movie, it’s a little bit peculiar. And I think when people hear about a movie that’s a little bit off-beat, they want it to surprise them, because otherwise they’d be going to see the latest overhyped, bloated studio movie whose every beat is totally expected. And I think that the heart of this movie is in the right place, and people enjoy not quite knowing what’s going to happen.”

One of the surprises, in fact, is that “The Matador” isn’t the small film with a largely unknown cast that Shepard himself expected it to be. After finishing the script, he recalled, “I said to my agent, if someone wants to buy this without me directing, they’re going to have to pay me so much money that it would be ‘an offer I couldn’t refuse.’ But I wasn’t about to let it go without that. I write so that I can find work as a director. I like the combination of the two.” But he added: “I wrote it never expecting a movie star like Pierce to want to play a character who’s such a scoundrel, and was fully intending to make it as a million-dollar or so thriller, a black-comedy thriller, and never expected it to become a bigger film, because I thought no sane actor would want to play that part. And Pierce got ahold of the script as a sample of my writing–I was trying to get a writing job at his company–and he called me up and said, ‘Look, I read this script and I’m actually interested in it, in starring in it and producing it.’ A pretty amazing phone call to get! So in a way, instead of me trying to get Pierce, Pierce kind of came to me and said, ‘I like this.’ He saw how perfect a part it would be for him. That Pierce came to me is an amazing situation, because in a way Pierce is the most perfect person to play this part. And I love the idea of showing a different side of an actor. And the timing for Pierce of this movie is perfect. He’s clearly moved on from Bond, and this is a way for him to say, ‘Hey, this is a different side to me as an actor that you might not have seen before.’”

But Shepard wasn’t entirely certain that Brosnan’s taking the lead would preserve the integrity of his vision for the film, despite the fact that he would be directing. “I said to him, ‘Look, I’m not going to change the script. I’m not going to tone it down. I don’t want to tone down your part. I don’t want you to wear suits, I don’t want you to look perfect, I want some gray in your hair, I want you to have a moustache.’ And he said, ‘Great. I like it the way it is.’ Early in the process we both agreed on what kind pf character we wanted to play, and ultimately Pierce just went for it. I thought it was really a ballsy ride for him. He got it–he understood that this is almost a larger-than-life character. He found the dark humor in it, and he found the soul of it. Pierce has so much soul as a human being, and he brought so much of it to the movie, that I felt like movie would have never worked with any other actor.”

Brosnan’s attachment to the project had a further effect, of course. “Once Pierce came on board,” Shepard said, “obviously it became a much bigger movie in terms of budget and my ability to then suddenly cast actors whom I really wanted. I was able to get Greg Kinnear and Hope Davis, who were my first choices–which is very nice, to get your first choices for anything. So it really was a beautiful situation.”

Though his script wasn’t toned down during shooting, Shepard noted that changes and additions were made on the spot. One alteration was the hotel lobby scene he’d mentioned earlier. “That scene, actually, specifically was not in the script,” he said. “We were shooting at the hotel that they’re in in the movie, and we were staying in the hotel as well. And as we started shooting I said, ‘You know, this lobby is so great, we should shoot something here.’ And then I said, ‘Pierce, wouldn’t it be funny if you walked through the lobby in your underwear?’ And he looked at me and said, ‘Well, can I wear my boots?’ And I said, ‘Okay.’ And he said, ‘Okay, Shepard, you’ve got one take.’ And we had four extras–all those people in the deep background are real hotel guests. You can only imagine what they were thinking. The scene was improvised in the sense that it wasn’t in the script, but I understood that he got the character and he trusted the process that we were going through so I could suggest to him something like that and he would say yes. You know, all you really want is for an actor to try stuff. If it didn’t work, if it weren’t funny, or if it was stupid, we wouldn’t have used it. It was to Pierce’s credit–I think he was having a gas. He’s so used to doing these giant-budgeted movies, where they’re spending more time making sure his hair’s in the correct position than they are in being free and letting him find a great rhythm and doing things that are off-beat, I think he really enjoyed the fact that the process was about the performance.”

Although “The Matador” involves locales as disparate as Colorado, Budapest and Manila, it was shot entirely in Mexico City, where the major portion of the story is set. “It was quite an undertaking,” Shepard remarked. “Thankfully I had a great production design staff. And I don’t think people can tell that we did the whole thing in Mexico.” He added: “We created snow for Denver. We used all the ice in Mexico to make snow. You couldn’t get a Margarita that night in Mexico City!”

Richard Shepard’s “The Matador” is one of the first releases of The Weinstein Company.