Laws on this in the US vary by state, so I will use maryland as an example.
Findlaw's page "Maryland Assault and Battery Laws" says:
Historically, assault has been closely associated with battery as assault often refers to threats of, or attempts to cause, physical harm to another while battery refers to actual physical harm. However, in the modern era, assault and battery are defined differently among states, with some states incorporating all related crimes under assault.
That's the case in Maryland which has different degrees of assault (not battery) based on the type of harm involved. For example, while common assault or second degree assault involves threats of, or actual, offensive physical contact, first degree assault involves threats of, or actual, serious physical injury. Offensive physical contact is that which a reasonable person would find offensive while serious physical injury is defined as those which:
- Create a substantial risk of death; or
- Cause permanent or protracted serious disfigurement or functional loss or impairment of body parts or organs.
Thus pointing a gun at someone under circumstances which convey a threat to shoot that person is a "threat of ... serious physical injury" using a firearm, and so constitutes first degree assault (with 2nd degree as a lesser included offense). However The page also says that:
Defenses include:
- Self-defense
- Defense of others
- Mistake of fact
- Lack of Intent
- Coercion
- Duress
The actual law § 3-202. Assault in the first degree provides that:
(a) Prohibited
(1) A person may not intentionally cause or attempt to cause serious physical injury to another.
(2) A person may not commit an assault with a firearm
But does not define "assault" specifically.
This page from a Law firm says:
Maryland criminal statutes consider “assault” to include the crimes of assault, battery, and assault and battery. Assault is the attempted touching of a person without his or her consent, including under those circumstances where the person feels fearful that a touching will occur.
This page from another law firm says:
Assault in the Second Degree can be committed in a variety of ways including an Intent to Frighten, an Attempted Battery, or a Battery.
In order to convict a defendant of Second Degree Assault under the Intent to Frighten theory, the State must prove:
- That the defendant committed an act with the intent to place the victim in fear of immediate offensive physical contact/physical harm;
- That the defendant had the apparent ability, at that time, to bring about the offensive physical contact/physical harm; and
- That the victim reasonably feared immediate offensive physical contact/physical harm; [and]
- That the defendant’s actions were not legally justified.
...
As with any assault charge, it is a defense if the defendant committed the assault (1) in defense of others; (2) in defense of his/her habitation; (3) in defense of property; or (3) in self-defense. Each of these defenses have specific elements and constitute a legal justification for the defendant’s assaultive act.
In short, pulling a gun on a mugger as described in the question would, at least technically, constitute First Degree Assault in Maryland. However self-defense would be a valid defense, and would preclude any conviction.
In practice, if a police or other witness saw the act and it seemed clear that the action was in fact one of self defense, the police would be unlikely to arrest the person who pulled the gun or refer such a case to the prosecutor, but they could if they so chose, and might if they were unsure that the case was truly one of self defense.
If such a case was referred to the prosecutor, s/he would normally decline to prosecute if satisfied that it was a case of self defense, or even if the issue of self defense was enough to raise a reasonable doubt. But that is a judgement call to be made by the prosecutor (or a lawyer on the prosecutor's staff).
At trial, if the jury (or judge) believed that the accused acted in self defense or had a reasonable doubt as to whether the accused acted in self defense, there should be an acquittal. Of course that depends on the exact evidence presented, and how the jury (or judge in a bench trial) views it. But that is what the law provides.
I think that if the prosecution evidence showed that the accused acted in self defense, that would end the case, so this is not technically an affirmative defense that must be raised by the defendant. But self defense is most often presented as part of the defense case when it is an issue.
So the events described could be viewed as an assault, but with a fairly obvious defense, if the witness was accurate.