Nic Pizzolatto had the vision, but it was Matthew McConaughey who gave voice to “True Detective,” HBO’s languid, Louisiana-set murder mystery that serves up a tasty gumbo of earthy characters, gritty drama and surrealist storytelling.

Pizzolatto wrote the first two episodes of “True Detective” on spec. McConaughey’s early commitment to star in the eight-hour series lured Woody Harrelson as co-star and sparked a bidding war for the project in the spring of 2012.

Most of all, Pizzolatto says, it’s the authenticity McConaughey brings to the role of haunted detective Rust Cohle — who frightens and fascinates with his stream-of-consciousness observations about the clues and the motivation behind a series of grisly murders —- that makes “True Detective” sing.

“In the hands of a lesser actor, many of these lines would sound ridiculous,” Pizzolatto says. “Not only does Cohle speak very uniquely, but you need an actor who can sell that. It’s my job to be able to write to an actor’s skill, but Matthew has such a total understanding of the character that he just possessed it in every way you could hope.”

In fact, McConaughey cast himself as Cohle, even though he was first approached to play Harrelson’s character, conflicted family man Martin Hart. “I wanted to get in that dude’s head,” McConaughey tells Variety. “The obsession, the island of a man — I’m always looking for a guy who monologues. It’s something really important as I feel I’m going into my better work.”

Pizzolatto credits McConaughey’s CAA rep, Jim Toth, for being open to a TV project even in the midst of the campaign to rehabilitate his client’s reputation as a formidable actor. That decision says a lot about the industry’s esteem for TV, but it also speaks volumes about McConaughey, who came to the “True Detective” set in late January 2013, right after completing “Dallas Buyers Club.”

Production in and around New Orleans ran until June, and it was not an easy shoot, Pizzolatto admits, especially for actors accustomed to the pace of features.

“It was arduous. These guys were incredible troopers,” Pizzolatto says of McConaughey and Harrelson. “We had a lot of hard weather, hard environments to work in and lots of material. They just kept going and going.”

The longer they went, the richer the performances became (Pizzolatto calls it a “Newman-Redford thing”). McConaughey clearly thrived on the ability to live in the skin of a wonderfully weird character for such a long stretch.

“It’s a 450-page script,” McConaughey says. “You have a 180-page first act (allowing for) stuff that films cut first — first-act character development. I’ve seen detective roles since then and they just pale in comparison.”

Harrelson says the only reason he considered being part of the project was because McConaughey recommended him. “I had done two comedies with him, and we hung out for countless hours,” he notes, adding that he found the working experience very different this time around.

“Playing Cohle, he became a different man,” Harrelson says. “We didn’t communicate the same. It wasn’t Matthew, it was Rust Cohle I was dealing with, and he made me genuinely furious several times. Wonderful work. But not play.”

Getting to watch McConaughey work and getting to know him off screen was a treat for Pizzolatto and others on “True Detective.”

“The guy just has a very clear focus, and his head is screwed on as right as any man I’ve ever known,” Pizzolatto says. “He presents a kind of American masculinity that we don’t see as much anymore. He’s in a great place in his life and I’m grateful our show got to be a part of that. As a fan I’m glad he’s now being allowed to be the kind of star that people always said he was going to be.”