Cartel Land” director Matthew Heineman put his life on the line to take viewers into the heart of the drug wars that are ripping Mexico apart.

But his camera doesn’t stop on that side of the Rio Grande. The documentary also focuses on Tim “Nailer” Foley, the head of a paramilitary group in Arizona that polices an often porous border. In Mexico, Heineman focused on Dr. Jose Mireles, a doctor by day and the head of a citizen task force called the Autodefensas that is trying to weaken the stranglehold the cartels have on their daily lives by taking up arms.

In Heineman’s hands, “Cartel Land” paints a portrait of vigilantism that is both galvanizing and deeply troubling, and the lengths to which some brave men and women are willing to go when governments fail in their duty to protect and safeguard their citizens.

Variety spoke with the documentary filmmaker about the dangers he faced in bringing the story to the screen, as he crisscrossed between the United States and Mexico, across meth labs and hideouts, in an effort to make sense of the lawlessness that threatens people in both countries and the drug trade that fuels it. “Cartel Land” will screen at this year’s Tribeca Film Festival, having previously earned strong notices at the Sundance Film Festival.

Why did you decide that Foley and Mireles would be your protagonists?

I wanted to create this parallel story about vigilantism on both sides of the border with this shared common enemy — the Mexican drug cartels. There’s obviously big differences in these two different movements and these two different characters, but there are many things that tie them together as well. That dichotomy. That parallelism fascinated me.

My previous film, “Escape Fire,” was a more expansive look at how and why our health-care system is broken. I wanted this to be a more deeply personal and character-driven film, not a survey film or a film with talking heads. I wanted it to be experiential, in which I was embedded with the subject. I ended up getting a lot closer than I thought that I would.

You were on the ground during several shootouts. It seems dangerous, to put it mildly. Were you scared for your safety?

It was frightening, there’s no way to deny that. I’d never had any experience shooting in a war zone. A lot of times I was behind the camera for a lot of those scenes. That had some sort of calming effect. Just focusing on framing, you know composition, that allowed me to slightly calm my nerves when bullets were flying or I was in a meth lab.

Were you ever in a situation where you felt, ‘I’m out of my depth here’?

Many times. Every single minute you’re down there you have your antennas up. There’s danger around you at all times.

We had a security firm that was tracking us with a beacon, so if something bad happened we could press an SOS button and we could be extracted. They’d also know if we got kidnapped, where we got kidnapped from. Every morning we’d have a set of journalists around Mexico that we’d call and tell them what road we were driving on and what towns we were going to so they’d know if we got kidnapped where we’d be. We took as many precautions as we could, but at the end of the day when you’re in a shootout, there’s not much you can do.

When that first shootout happened I definitely thought, “What am I doing here and did I go too far?”

Was it hard to readjust to life outside of Mexico?

It was very hard for me to come home after being in places like that and situations like that and come back to Manhattan. It often took me days to sort of become normal again. It still affects me. It’s still something I think about. I dream about. I have nightmares about. I still worry constantly about the people in the film and the implications of the release of the film on them and on my local crew.

There was one interview, with that young woman whose husband was kidnapped by the cartel and chopped up. Sitting across the table from her and in the same room with her, seeing this woman whose body was next to me but whose soul was ripped out from the inside and whose eyes were so hollow, that interview affected me more than any other experience. Just to think that we’re the same species as human beings that would do that to somebody it messed with me.

You’re looking at two different forms of vigilantism in this picture. What point were you trying to make about people who take the law into their hands?

The thing that provoked me to make the film was what would I do if violence came to my door? What would I do if my sister was raped or my brother was murdered by the cartel or hanged from a bridge? Would I stand up? Would I take up arms? Is vigilantism sustainable? Is it just?

Without spoiling the film, it becomes clear that the Autodefensas are deeply flawed and morally complicated. Did that surprise you?

Originally, I thought I was telling this simple hero/villain story of guys in white shirts fighting against this evil cartel. Slowly over time I realized that the story was much more complicated. That grayness, that complexity, is what drove me to keep going down there to find out the truth of what was happening.

You start to see things that provoke you to wonder. Where are the guns coming from? Where are the bulletproof vests coming from? Where are the armored cars coming from? Who’s funding these people? How are these every day townspeople, farmers, ranchers, businessmen, how are they beating back the cartel?

The whole situation just seemed hopeless. Some people stand up, but the violence continues and the demand for drugs is just as strong. Can anything change?

I’m an eternal optimist. I really wanted to believe that this citizen revolution would succeed and that this experiment would work, but it didn’t. Even if the Autodefensas beat back the cartel, there’s always going to be someone making meth. There’s always going to be somebody in the states consuming that meth. As long as there’s demand here, there will be a supply from down there.

There is some hope. You can’t forget that five years ago, 10 years ago, 30 years ago that people never would have even considered speaking out against the cartel. You’d walk around shrouded in fear. The idea of Jose Manuel Mireles standing in the middle of town speaking to 5,000 people and saying to the head of the cartel, ‘I’m going to come after you’ — no one ever dreamed of doing that.

Right after we submitted to Sundance, 43 students were killed in Guerrero, Mexico, just south of where we filmed. That led to hundreds of thousands of people marching through Mexico City in protest. There’s a bit of a Mexican Spring happening. People are protesting angrily about the collusion between the cartels and the government, as well as the absolute lack of justice in Mexico. The movement in the film speaks to that anger and the impatience and the feeling that the status quo cannot continue.