There has been a lot of confusion about when it is permissible to kill and assailant who is using substantially less sophisticated and deadly weaponry. First, the question of proportional response was raised when Israeli soldiers shot and killed Flotilla passengers brandishing sticks and rods. Today, it was reported that a U.S. border guard shot and killed a teenager flinging rocks over the border in his direction.
Thankfully, we have legal terms that help us sort out this dilemma.
The right to self-defense in criminal law is born out of necessity. In other words, you can't kill someone in self-defense without proving that the deadly force was necessary. (United States v. Peterson, 1973). There must be an imminent threat. The belief that killing in self-defense was necessary must be objectively reasonable (New York v. Goetz) and the force used must be proportional. So, for example, a police officer may only use deadly force to stop a fleeing suspect if they have a reasonable belief that the suspect poses a significant threat of death or serious physical harm to others (Tennessee v. Edward Garner, 1985).
The Model Penal Code supports this common law interpretation, stating "A person is justified in using force upon another person if he believes that such force is immediately necessary to protect himself against the exercise of unlawful force by the other on the present occasion." (MPC § 3.04(1))
When the border official was interrupted in the middle of making an arrest by flying rocks, he was certainly subject to imminent harm. Because the border patrol officer was at work, he was not obligated to retreat and avoid confrontation (the idea here is that his retreat would allow the suspects to go free, thus undermining law and order). It was necessary that something be done.
What is not supported, however, is the decision to take a break from arresting suspects on the border, turn to the child throwing the rocks and shoot him in the head. The officer did not, according to all accounts, ask for assistance in stopping the child from throwing the rocks, call over to the Mexican border patrol and ask them to stop the child from throwing the rocks or ask for assistance from another officer in moving the suspects he was arresting away from the reach of the rocks.
Because deadly force was not necessary to escape the harm -- a harm that was likely not serious enough to justify the shot in the first place -- the officer clearly acted outside of his legal right to defend himself.