In making his documentary “Cartel Land,” director Matthew Heineman gained access to vigilante movements, on both sides of the U.S.-Mexican border, pushing back against the drug cartels. He interviewed victims to heinous horrors, and the operators of a Mexican meth lab.

The key to gaining the trust of the subjects of his project, says Heineman, is “transparency and time.”

“There’s so little money in long form journalism,” Heineman says. “There’s so few people who are able to do what I did. There’s a lot of people who are covering this story in Mexico and they come in for a day or two or three days and it is really difficult if not impossible to tell a layered complex story, which is what the story was.”

For almost a year, Heineman spent one to two weeks out of each month shooting “Cartel Land,” which opens on Friday and recently screened at AFI Docs in Washington.

In the Mexican state of Michoacan, he followed Jose Mireles, a physician who leads the Autodefenses citizens group fighting the violent Knights Templar drug cartel. In Arizona’s Altar Valley he followed Tim Foley, who leads a citizens paramilitary group patrolling the border.

“We as Americans have become obsessed by ISIS and frightened by ISIS,” Heineman said. “But there is a war that is happening in the country to the south of us. Eighty thousand people have been killed since 2007. Twenty-thousand plus people have disappeared. And this is a war that we are largely responsible for. We are feeding it.”

Heineman originally conceived of the project as one that focused on Foley, shooting for about three months at the border. Then his father sent him an article about the Autodefenses, a group of citizens that were reclaiming small towns from the control of Mexican cartels, and it gave him the idea of a “parallel narrative.”

Within two weeks, he was in Mexico, trying to make sense of the scene.

“I originally thought that this was a very simple story, especially on the Mexican side,” he says. “Very, very quickly I realized that this story was much more complex and much more gray, that the lines between good and evil were not that clear. I became obsessed with trying to figure out what was really happening, who these guys truly were, where the movement was going, what the endgame was.”

Mireles is a charismatic figure who convinces residents of towns to join his movement or at least resist the cartels and their terrors, but, as the movie shows in one of its surprising twists, he has his own flaws, as does his group and their retaliatory tactics. And the movie depicts some of the skepticism that residents have toward these vigilantes — even when the alternative it corrupt government.

“The basic government institutions that we take for granted don’t exist there,” Heineman says. “If they do exist, they are most often in absolute collusion with the cartel, or paid by the cartel or threatened by the cartel.”

Heineman, who had never covered a war or combat situations, was in the midst of shootouts, several of which were depicted in the movie. He took precautions, like employing a security firm that tracked their movements. But he says that the “scariest moment” was an interview with a young woman who, along with her husband, had been kidnapped. She witnessed her spouse being chopped into pieces and burned to death.

“To sit in this room and talk to this woman whose body was there, but whose entire soul had been sucked out of her, and to look into her eyes and to see the hollowness there, and to hear her describe the horrors of what she witnessed, and to think that we are the same species of human beings that would to that to other people. That stuck with me much more than those sort of ‘adrenaline moments.'”