In the film, which opens Friday, they play two North Carolina politicians competing in an increasingly nasty Congressional race. Galifianakis' character shoots Ferrell's point blank and his poll numbers go up. That would seem hopelessly extreme in its absurdity if this wasn't an election year where real headlines have often seemed the stuff of high comedy.
It's a ready-made concept that pits two of the best comedians in movies against each other for the first time in a major project. In comedy, a Ferrell-Galifianakis ticket is a winner in a landslide.
The two first crossed paths at "Saturday Night Live," where Ferrell was a veteran standout and Galifianakis was making a short-lived stint that wouldn't last three weeks.
"Hey Zach, have they told you what you're doing?" Ferrell recalls saying to a confused Galifianakis at the time.
They hadn't told him - not an uncommon consequence of "SNL" boss Lorne Michaels' sometimes inscrutable ways. To make matters worse, Galifianakis had come to the show under the mistaken impression he was to be a cast member - the big break of his career - when he was actually hired as a writer.
His term at "SNL" was remarkable only for an attempt to convince guest host Britney Spears to do a sketch in which, during an "Entertainment Tonight"-style interview, she inexplicably begins bleeding from the mouth.
Ferrell would eventually exit "SNL" and launch a very successful movie career, while Galifianakis continued with stand-up and various projects before "The Hangover," too, made him one of the most sought-after comics in Hollywood.
Ferrell, 45, approached Galifianakis, 42, about teaming up, and the two quickly took to brainstorming. Their initial idea was to do a male-centered version of "Toddlers & Tiaras," the TLC show about child pageants.
"We were going to play two dads, which would have really been hard to pull off because of the creep factor," Galifianakis said in a recent joint interview with Ferrell. Both recoil at the thought of shooting such a comedy while the Jerry Sandusky scandal at Penn State was playing out: "If we were in the middle of shooting the boy pageant movie?" says a wide-eyed Ferrell. "Aye Toledo!"
It fell to Adam McKay, the director and frequent collaborator of Ferrell's, and a producer on "The Campaign," to, like an exasperated parent, nix the boy pageant idea. Instead, he suggested a political comedy. For a short time, they planned to make a movie based on the campaign documentary "The War Room," with Ferrell as a candidate and Galifianakis as a Karl Rove-like adviser.
Then it was suggested, "Why not be two competing guys, do a broader, more commercial comedy where we can still have a point of view," Ferrell recalled.
They turned to filmmaker Jay Roach, whose schizophrenic career as a director of farcical comedies ("Austin Powers," ''Meet the Parents") and acclaimed HBO based-on-real-life political dramas ("Recount," ''Game Change") made him a natural choice.
With little more than the outline of a promising concept that would match the two comedians mano-a-mano, the movie was green lit with a production schedule and a release date that would lend the obvious tie-in to the 2012 presidential election. The script by Chris Henchy and Shawn Harwell came later.
"Their chemistry is amazing but it's almost unlikely," says Roach. "They couldn't be more different in their physicality, their attitudes. Will's so instantly accessible and then there's other things going on. Zach is instantly inaccessible and then there's other things going on."
From the start, it was conceived as a platform for Seth Galifianakis, the comedian's fictional brother character, a sometimes racist Southern effeminate with a mustache (as opposed to Galifianakis' usual beard). In the film, Galifianakis plays a version of the character named Marty Huggins.
Knowing the setting was North Carolina, Ferrell found inspiration in former senator John Edwards, albeit with shades of his President George W. Bush impression from "SNL."
Part of the thrill of seeing Galifianakis and Ferrell square off is that they seem to have an offbeat rhythm set to the same metronome. Though they come from different sides of the comedy spectrum (Galifianakis from stand-up, Ferrell from improv), they share an uncommon ability for stretching awkwardness beyond the threshold of most.
"I have learned as a stand-up it's much better for acting to go the way of someone that has improv training and pay attention to that," says Galifianakis. "It is much better if it's a group effort. I always say less is more, for me. I don't need to say a lot of things. I don't want to say a lot of things. (in a whisper) I don't want to work."
The two have worked together a few other times, including a memorable video for Galifianakis' beloved Web series "Between Two Ferns" and a tour for Funny Or Die (the website Ferrell co-founded) in 2008 that played for college audiences of thousands. In Ferrell's opening, Galifianakis and other comics on the tour played ninjas attacking him.
"It was like a rock show," Galifianakis recalls. "It was like being in Toto."
"Or DeBarge," chimes Ferrell.
"DeBarge," Galifianakis solemnly nods in agreement.