The U.S. has been fighting the war in Afghanistan for more than 12 years, and few Americans have come to know the country in the way Dilip Joseph has. Joseph, who has been there 10 times in the past four and a half years, is a doctor who works with a nonprofit group and trains health care workers.

The job has taken him to clinics and community centers deep in the war zone. "The motto is to 'work yourself out of a job,' " he says. "Equip others, train others in areas where you've gotten training."

Joseph tells All Things Considered's Arun Rath that he has always been aware of security concerns. But his last trip — his 10th — was different. On Dec. 5, 2012, he came face to face with the Taliban.

"On this particular occasion, we were travelling from Kabul to one of our most rural community centers," he says. Joseph does not speak Pashto, the local language, so he travelled with two Afghan colleagues. After finishing their work that day, they went to a local police chief's house for lunch.

"There was some conversation going on about security measures in the area, and I didn't think much of it," he says. "I think, in retrospect, I was thinking maybe [the police chief] was picking up certain things that I certainly wasn't aware of."

So Joseph and his two colleagues began driving back to Kabul. As they came down a winding mountain road, a man with a gun suddenly emerged.

"I didn't see him initially, but the driver did, and he put the brakes on very quickly," Joseph says. "As soon as this guy fired a warning shot, we saw more people from the front and the back sort of cover us. I think there were about four of them with guns that covered us right away.

"Being an ethnic Indian — I look not very different from [the insurgents]. So they certainly didn't know who the foreigner was, so I don't think they picked up on the fact until we were put back into our vehicle and taken to a very remote area," he adds. "At that point, they looked a bit more closely through my belongings and my backpack, and unfortunately I had my American passport in my bag. And they figured out I was an American."

That, Joseph says, changed things dramatically.

"At that point, they knew right away — just from looking at the passport — that they could raise the stakes, so to speak," he says.

"We got to this remote valley. Our hands were tied, and we started hiking, which was very difficult," Joseph says. "That hiking took about nine, nine and a half hours. So when we did sit down for the very first time, I did try to connect with them, saying, you know, 'I'm originally from your part of the world, and I come here to treat your brothers and sisters and your mothers and fathers.' I wanted that to be a two-way conversation, but it was very much a monologue."

At this point, he says, the idea that his life was in danger was at the front of his mind. So he went through an "interesting and very relieving exercise" of realizing that he could be killed.

"I thought through all the different ways I've already had a very blessed life, and counted all the different ways that I've been able to live a good life so far," Joseph says. "So I did, certainly, go through that mental exercise of realizing, 'Yeah, this could be a dire situation for me.' ... I didn't want to be pissed off right before getting killed."

As the sun went down, Joseph says, the group hiked by moonlight to a remote shack. There, the three kidnappers made their demands: they wanted $300,000 and threatened to take the group to Pakistan if they didn't receive the money. They also threatened to kill the hostages if the captors' commands weren't obeyed.

He was allowed to call his office in Kabul to report the kidnapping and to relay the demands. But as the second day wore on, the group lost cell phone service. And through the translator, Joseph's three captors began to talk with him.

"They had a lot of questions about what my life was like, what my family was like, and why I do what I do," he says. "And, you know, going through that — opening up my own life — really enabled this one young man, who was 19 years old, to open up about his own life.

"He was sort of almost comparing his life to mine. And in that conversation, I figured out that he was 19 year old, and I stopped him right there and said, 'You know, I'm 39, and I'm old enough to be your father.' And then he opened up about his father being in prison for the past 14 years. So essentially he had only seen his father for five years, and those five years, all he had seen his father do were insurgency activities. And so he made this conclusion of, 'Well, your parents taught you something else than what my parents taught me, and that's why you do what you do. And the reason why I do things that I do is because I haven't been taught anything else.' "

Joseph says negotiations for his release eventually broke down, and by the fourth day of captivity, the kidnappers decided to split up the group.

"When my colleagues left, I pretty much figured that this was the last time we were going to see each other," he says. "So I hugged them goodbye and teared up as I was doing that. And three of these five men came up and wiped my tears. Of course, a couple of them didn't even bother connecting with me. If anything, they would make rude gestures about how they were going to kill me and about how they were happy about this whole captivity."

Then came the fourth night. At that point, Joseph was being held in a small, pitch-black room. He heard dogs barking outside and the sheep making noise. He also heard gunfire. Then a man burst through his door: It was a Navy SEAL, a rescue operation. But Taliban gunfire hit that man, who was a member of the elite SEAL Team Six.

Other members of the SEAL team called out to Joseph, and he called back.

"As soon as the SEALs recognized where my voice was coming from, one of them just came and laid on top of me. And others must have taken out most of these guys, except for the 19-year-old," Joseph says. "So as I walked out, I saw this 19-year-old just lock eyes with me. And then when I was brought back into the room, because the helicopter was going to take a few more minutes to come, I did see that he was also killed."

In a few short moments, it was all over. The Navy SEAL who had been shot, Petty Officer 1st Class Nicolas Checque, was dead. He was 28 years old. A helicopter arrived and brought Joseph to a military base. His Afghan colleagues also made it to safety.

A few days after the rescue, Joseph returned home to his family in Colorado. In a statement, they said: "We could not be more grateful for that soldier's heroism and for the bravery of all involved in the mission to bring Dilip home."

Since then, Joseph says he has had time to sort out the complicated emotions of his captivity:

"What [this experience] made me realize is that even the Taliban can be reached. Because at the end of the day, they realize that this is a dead end, what they're doing. And they're also having the simple desires that you and I have — for a better future, better education for their kids. So this experience does give me — as ironic as this sounds — more hope than I had even before."

Copyright 2018 NPR. To see more, visit http://www.npr.org/.

ARUN RATH, HOST:

The United States has been fighting the war in Afghanistan for more than 12 years now. And few Americans have come to know the country the way this man has.

DR. DILIP JOSEPH: My name is Dilip Joseph, and I'm a medical doctor that works with an organization called Morning Star Development. And the place where we work is Afghanistan.

RATH: Dr. Joseph has been to Afghanistan 10 times in the last four and a half years. And his work has taken him to clinics and community centers in the war zone where he trains local health care workers.

JOSEPH: The motto is to work yourself out of a job, equip others, train others in areas where you've gotten training.

RATH: Joseph says he has always been aware of security concerns. After all, this is Afghanistan. But this last trip, his tenth, was different. On December 5, 2012, Dilip Joseph came face-to-face with the Taliban. That's our cover story today: one man's account of kidnapping, captivity and, ultimately, rescue.

(SOUNDBITE OF MUSIC)

JOSEPH: On this particular occasion, we were traveling from Kabul to one of our most rural community centers.

RATH: Joseph does not speak the local language, Pashto. And so he traveled with two Afghan colleagues from his organization. After finishing their work that day, they went to a local police chief's house for lunch.

JOSEPH: There was some conversation going on about security measures in the area. And I didn't think much of it. I think in retrospect, I was thinking maybe he was picking up certain things that I certainly wasn't aware of.

RATH: Dr. Joseph and his two Afghan colleagues started driving back to Kabul. As they came down a winding mountain road, a man with a gun suddenly popped out.

JOSEPH: I didn't see him initially, but the driver did, and he put the brakes on very quickly. As soon as this guy kind of fired a warning shot, we saw more people from the front and the back sort of cover us. I think there were about four of them with guns that covered us right away. You know, I - being an ethnic Indian, I look not very different from them. So they actually certainly didn't know who the foreigner was. So I don't think they picked up on the fact until we were put back in our vehicle and taken to a very remote area.

At that point, they looked a bit more closely through my belongings and my backpack. And unfortunately, I had my American passport in my bag. And then they figured out I was an American.

RATH: Which, I imagine, changed things dramatically.

JOSEPH: Yeah. I mean, at that point, they knew right away just from looking at the passport that they could raise the stakes, so to speak.

RATH: So once they had determined your American citizenship, what happened from that point?

JOSEPH: We got to this remote valley. Our hands were tied. And so we started hiking, which was very difficult. That hiking itself took about nine, nine and a half hours. So when we did sit down for the very first time, I did try to connect with them in saying, you know, I'm originally from your part of the world. And I come here to treat your brothers and sisters and your mothers and fathers. I wanted that to be a two-way conversation, but it was very much a monologue.

RATH: How much at this point are you in fear for your life?

JOSEPH: Oh, very much so. I mean, that idea of perhaps my life is in danger is certainly in the forefront of my thinking. So I went through a very interesting and very relieving exercise of just kind of coming to the consensus that I could be killed, and thought through all the different ways I've already had a very blessed life, and counted all the different ways that I've been able to live a good life so far. So I did certainly go through that, you know, mental exercise of realizing, yeah, this could be a dire situation for me.

RATH: That's just kind of remarkable to me, though, that you make the most of those several hours you have walking to make peace with yourself.

JOSEPH: Yeah. I mean, I figured it's either that or not being at peace. And I didn't want to be - the way I look at it - be pissed off right before getting killed.

RATH: As the sun went down, the group hiked by moonlight to a remote shack. There, the three kidnappers made their demands.

JOSEPH: They needed us to provide around $300,000. Then the other demand was within two to three days, this needs to be settled. If not, the Pakistan Taliban will come and take you to Pakistan. And then the last demand was during this time, if you don't follow our commands and our requests, we will kill you.

RATH: Joseph was allowed to call his office in Kabul to report the kidnapping and to relay the demands. But as the second day wore on, the group lost cellphone service. And through the translator, Joseph's three captors began to talk with him.

JOSEPH: They had a lot of questions about, you know, what my life was like, you know, what my family was like and why I do what I do. And, you know, going through that, opening up my own life, really enabled this one young man who was 19 years old to open up about his own life. He was sort of almost comparing his life to mine. And in that conversation, I obviously figured out that he was 19 years old.

And I stopped him right there and said, you know, I'm 39 and I'm old enough to be your father. And then he opened up about his father being in prison for the past 14 years. So essentially, he had only seen his father for five years, and those five years, all he had seen his father do was insurgency activities. And so he made this conclusion of, well, your parents taught you something else than what my parents taught me, and that's why you do what you do. And the reason why I do things that I do is because I haven't been taught anything else.

RATH: Dr. Joseph says the negotiations for his release eventually broke down. By the fourth day of his captivity, the kidnappers decided to split the group up.

JOSEPH: When my colleagues left, I pretty much figured that this is the last time we were going to see each other. So I hugged them goodbye and teared up as I was doing that. And three of these five men came up and wiped my tears. Of course, some of them - a couple of them didn't even bother connecting with me either through gestures. If anything, they would make rude gestures about how they were going to kill me and how they were happy about this whole captivity.

RATH: Then came the fourth night. At that point, Dr. Joseph was being held in a small room. It was pitch black.

JOSEPH: I heard something happening outside in terms of dogs barking and the sheep making noise. And my nose had started running at that time, so I was totally awake. And that's when I sort of heard this very loud firing of the gun, and I figured that that was from my insurgents.

RATH: Joseph says Taliban gunfire hit the first man to come through the door. It was a Navy SEAL and a member of the elite SEAL Team Six. This was a rescue operation. The other members of the SEAL team called out to Joseph, and he called back.

JOSEPH: As soon as the SEALs recognized where my voice was coming from, one of them just came and laid on top of me, and others must have taken out most of these guys, except for the 19-year-old. So as I walked out, I saw this 19-year-old just lock eyes with me. And then when I was brought back into the room, because the helicopter was going to take a few more minutes to come, I did see that he was also killed.

RATH: In a few short moments, it was all over. The Navy SEAL who had been shot, Petty Officer 1st Class Nicholas Checque, was dead. He was 28 years old. A helicopter arrived and brought Joseph to a military base. His Afghan colleagues also made it to safety.

A few days after the rescue, Joseph returned home to his family in Colorado. In a statement, they said: We could not be more grateful for that soldier's heroism and for the bravery of all involved in the mission to bring Dilip home.

Since then, Joseph has had time to sort out the complicated emotions of his captivity.

JOSEPH: This whole experience for me, what it made me realize is this simple and yet maybe a complex situation that even the Taliban can be reached. Because at the end of the day, they realize that this is a dead end, what they're doing. And they're also having the simple desires that you and I have for a better future, better education for their kids and what have you. So this experience does give me, actually, and as ironic as it sounds, gives me more hope than I actually had even had before.

(SOUNDBITE OF MUSIC)

RATH: That's Dr. Dilip Joseph. Last year, he was kidnapped in Afghanistan and held captive for five days. Despite that experience, he says he would like to return for what would be his 11th trip to Afghanistan. Transcript provided by NPR, Copyright NPR.