This is difficult. I could let him go, but I don't know if he will try to take revenge and attack me with another weapon immediately, or later in the future. He could also harm someone else if I let him go now. While he did threaten my life, I don't think that killing him is the right way to resolve the scenario. I could injure him by shooting a leg or hand, but that might incite him to counterattack if he is hiding another weapon. Even if he doesn't counterattack, it could cause him to hold a lasting grudge, or be disabled for a long amount of time. I could call the police and have him arrested, but if he decides to run away while I make the call, I won't be able to catch him.
Here is my current solution, which is by no means satisfactory. I tell him to stay on the ground and talk to him. If he gets up, I shoot his leg. If he reaches for a weapon, I shoot him. As long as he cooperates, we just talk. I ask him why he tried to rob me. I ask him some personal questions. I tell him who I am, what I do for a living, etc. Then I ask him what he would do if the situation were reversed. Based on the conversation, I try to figure out if he will do something similar (robbing a person or threatening their life) again. If I think he will, I call the police. If I don't think he will, I tell him to walk away.
So that's the end of the answer, I'm just going to point out a few important things I though about. First of all, I decided to talk with him because with a decision this important, I need more information. I also realized that the decision has implications both immediately and in the long term future, and both need to be considered. In the end, I have to make my judgement call, and if I'm wrong, then I potentially ruin the lives of a bunch of different people. The problem I still have is that I have to judge an entire person on just a 2 minute conversation at gunpoint, leaving plenty of room for deception and mistakes.