Mark Wahlberg and Denzel Washington were at a corner table celebrating the start of production on their action-comedy “2 Guns” last year when they spotted an odd sight. On the dance floor, sweatily busting moves while surrounded by a gaggle of women, was their director: the rugged, bearded Icelander Baltasar Kormakur.

“Denzel looked at me and said, ‘What’s up with your boy?’ ” Wahlberg recalled as he sipped bottled water at a midtown restaurant last week, trotting out a not-bad impersonation of Washington. “And I said, ‘I don’t know. I’ve never seen him do this before.’ ”

Kormakur’s momentary burst of samba may have temporarily puzzled Wahlberg. But his overall exuberance has delighted the actor.

When the pair unveil “2 Guns” this weekend, they will offer the latest product — after last year’s surprise hit “Contraband” and the recently shot HBO pilot “Missionary,” which Kormakur directed and Wahlberg produced — of what is fast becoming one of Hollywood’s most odd-couple relationships.

There’s Wahlberg, the Southie kid who did time in jail before remaking himself first as the pop performer Marky Mark and then as an action star. And there’s Kormakur, a theater and film geek who started out making low-budget oddballs such as “101 Reykjavik” and “Jar City” and who lives in a northern Iceland town where sheep outnumber Homo sapiens by an unofficial count of 5 to 1.

“We’re not that different,” continued Wahlberg, 42, at the restaurant.

“We’re a little different,” said the director, 47, sitting next to the actor, his soulful mien dovetailing with Wahlberg’s brash exterior. “But not really that different.”

Based on Blake Masters’s adaptation of Steven Grant’s graphic-novel series, “2 Guns” centers on Wahlberg’s undercover Naval officer “Stig” Stigman and Washington’s undercover Drug Enforcement Administration agent Bobby Trench. Their identities concealed from each other, Stig and Bobby pretend to be criminals in the hope of nabbing a drug kingpin and his money — until they run afoul of Earl (Bill Paxton), a coolly vicious killer who may be a CIA operative.

Universal releases “2 Guns,” set in dusty towns on both sides of the Texas-Mexico border, in a summer season when mid-budget genre movies have fared well. With plenty of comic improvisation between Washington and Wahlberg, “2 Guns” is the kind of glorified B-movie in which, when the characters are not trying to outshoot various bad guys, they’re trying to outfox each other.

“ ‘Western’ is a dangerous word,” Kormakur said. “I just wanted to play with the Western idea while having two alpha males go at each other.”

The director said he used “Butch Cassidy and the Sundance Kid” as a reference point. Filmgoers will probably be reminded of a host of buddy pictures that have come since, with Kormakur, even in a big Hollywood production, slipping in the occasional Tarantino-esque sense of humor or cinematic homage (for example, a Sergio Leone reference via the extended barrel of a gun).

Wahlberg was actually attached to the film when it was being developed by David O. Russell. But when the director dropped out after disagreements with Universal and producer Marc Platt over the script, Wahlberg suggested Kormakur, with whom he was in the middle of postproduction work for “Contraband,” a remake of an Icelandic film starring and produced by Kormakur. (The two got acquainted when they agreed to remake that movie, the director impressing Wahlberg with his can-do attitude.).

Kormakur, who on his water-bound 2012 Icelandic-language feature “The Deep” often jumped in the ocean to shoot his main actor, has a certain roll-up-his-sleeves attitude on set.

“On the first day of shooting, I said to him during a long break, ‘Why don’t you go back to your trailer?’ ” Wahlberg recounted. “And Balt said, ‘I have a trailer?’ ”

Paxton, who to land his role dressed up in tough-guy Western garb even though he was meeting Kormakur in a Beverly Hills hotel, describes the director as a “man who had reserves of stamina even in the heat of August.”

Wahlberg said he was attracted to working with the director because, as a former actor, Kormakur understands what Wahlberg needs. But mostly, he said, it was about the masculinity.

“He’s a guy’s guy,” Wahlberg said, frequently slapping Kormakur on the back or nudging him with his elbow as they talked. “So you’re not going to get any weird [stuff].” He added that Kormakur often “wants to know if he could beat me in a fight. So we got all that [stuff] going on.”

Kormakur said his own sense of kinship with Wahlberg came from a more mystical place: When he watched “Boogie Nights” in the late 1990s, long before he contemplated a Hollywood career, he “just knew” he would one day work with Wahlberg, not least because the actor looked like a childhood friend. His face, that is.

— Los Angeles Times

2 Guns

At area theaters. Rated R for

violence, language and brief nudity. 109 minutes.