
592 F.3d 489 (2010)
UNITED STATES of America, Plaintiff-Appellee,
v.
Michael L. GORE, Defendant-Appellant.
No. 08-4462.
United States Court of Appeals, Fourth Circuit.
Argued: October 30, 2009.
Decided: January 12, 2010.
*490 ARGUED: Travis Ray Fitzwater, Law Office of Travis R. Fitzwater, Morgantown, West Virginia, for Appellant. David Earl Godwin, Office of the United States Attorney, Clarksburg, West Virginia, for Appellee. ON BRIEF: Sharon L. Potter, United States Attorney, Wheeling, West Virginia, for Appellee.
Before NIEMEYER, MOTZ, and DAVIS, Circuit Judges.
Affirmed by published opinion. Judge NIEMEYER wrote the opinion, in which Judge MOTZ and Judge DAVIS joined.

OPINION
NIEMEYER, Circuit Judge:
In defending charges that he forcibly assaulted a correctional officer at the Federal Correctional Institution (FCI) Gilmer, in Glenville, West Virginia, and forcibly resisted and opposed correctional officers there, both in violation of 18 U.S.C. § 111, Michael Gore requested that the district court instruct the jury on his affirmative defense of justification based on self-defense in the following form:
If the Correctional Officer uses more force than appears reasonably necessary, the person stopped may defend against the excessive force, using only the amount of force that appears reasonably necessary for his protection.
The district court rejected Gore's formulation as too subjective and requiring too relaxed a showing of excessive force. Instead, it instructed the jury that Gore could rely on justification based on self-defense only when "[h]e was under an unlawful present or imminent threat of serious bodily injury or death." The court elaborated,
[A] present or imminent threat of serious bodily injury or death must be based on a reasonable fear that a real and specific threat existed at the time of the [defendant's] assault, resistance, opposition, or impediment. This is an objective test that does not depend on the defendant's perception. If the defendant unlawfully assaulted resisted or impeded a correctional officer when no reasonable fear of [a] present or imminent threat of serious bodily injury or death actually existed, his self-defense justification must fail.
The jury returned a guilty verdict, and the district court sentenced Gore to 87 months' imprisonment.
On appeal, Gore challenges the district court's refusal to give his form of instruction for his affirmative defense. For the reasons that follow, we affirm.

I
Following a hostile verbal exchange between Gore and a correctional officer at FCI Gilmer, the correctional officer ordered Gore to report to Lieutenant Kevin Jensen. When the same type of exchange took place with Lt. Jensen, Jensen told Gore that he was going to be placed in the Special Housing Unit, a site for disciplinary segregation known as "the hole." The two then exchanged harsh words, and a scuffle ensued. When Correctional Officer Gregory Feathers, who was present, attempted to place Gore in restraints, the three men fell to the ground as Gore resisted. During the fight that followed, which was captured on video tape, Gore struck Lt. Jensen several times in the head, leading to serious injuries. Gore and Officer Feathers also sustained lesser injuries.
According to Gore, Lt. Jensen informed him that he was being sent to "the hole," at which point Gore asserted that Jensen was exceeding his authority. When Gore angrily called Jensen a "bitch," among other things, Officer Feathers grabbed Gore around the waist and neck to place him in restraints. During that attempt, Gore and *491 Officer Feathers fell to the ground, and Gore fought back, believing that he was going to be unnecessarily abused. Gore testified that he was accustomed to being given a warning prior to being searched or handcuffed and that he was given no warning before Officer Feathers grabbed him. He said that he panicked and started throwing punches because he was afraid of being seriously abused by Lt. Jensen and Officer Feathers. Gore denied assuming any "fighting stance," balling his fists, or otherwise making aggressive moves toward Lt. Jensen.
The officers' version differed. Lt. Jensen testified that Gore was angry and uncooperative when he first reported to him, yelling at Jensen as Jensen tried to sort out the situation. Lt. Jensen then made a radio call to clear the compound in order to make way for Gore to be sent to the Special Housing Unit. He ordered Gore to place his hands on a nearby trash can and submit to a pat-down prior to being placed in restraints. Gore initially feinted toward the trash can but then did not comply, instead facing off with Jensen and making his hands into fists. When Officer Feathers attempted to get control of Gore and place him in handcuffs, Gore resisted, and the fight ensued, resulting in injuries to all three men.
At trial, Gore argued that he acted in self-defense, and he requested that the jury be instructed on that affirmative defense. While Gore requested an instruction that would afford him the defense in the circumstance where a correctional officer uses "more force than appears reasonably necessary," the district court refused to use Gore's formulation and gave an instruction that afforded Gore the affirmative defense only when he could demonstrate that he was objectively "under an unlawful present or imminent threat of serious bodily injury or death."
After the jury convicted Gore and the district court sentenced him, Gore filed this appeal, arguing that the district court erred in refusing to give his requested form of self-defense instruction.

II
The question of whether the district court properly instructed the jury on the affirmative defense of justification based on self-defense to a charge under 18 U.S.C. § 111 actually raises two questions: First, whether self-defense is available as an affirmative defense to a § 111 charge, particularly when § 111 contains no language providing for any affirmative defense; and second, if the defense is available, what its formulation should be. We address these questions in order.

A
Gore contends that the courts may assume the existence of a justification defense[*] to federal offenses in appropriate cases, notwithstanding the lack of statutory text providing for the defense.
The government does not contest Gore's assertion. Indeed, it concedes that some minimal right of self-defense must be available to inmates charged under 18 U.S.C. § 111 because disabling an inmate entirely from protecting himself from wanton, unlawful aggression threatening death or serious bodily injury would violate the *492 Eighth Amendment's prohibition of cruel and unusual punishments.
The Supreme Court has stated that it remains an open question whether federal courts possess the power to imply common-law defenses where none are provided for in the relevant statute. See United States v. Oakland Cannabis Buyers' Coop., 532 U.S. 483, 490-91, 121 S.Ct. 1711, 149 L.Ed.2d 722 (2001). In Oakland Cannabis, the Court noted that generally the question whether "an exemption should be created is a question for legislative judgment, not judicial inference." Id. (quoting United States v. Rutherford, 442 U.S. 544, 559, 99 S.Ct. 2470, 61 L.Ed.2d 68 (1979)). The Court added, however, that it had previously discussed the possibility of a common-law defense to a federal criminal statute "without altogether rejecting it." Id. (citing United States v. Bailey, 444 U.S. 394, 415 n. 11, 100 S.Ct. 624, 62 L.Ed.2d 575 (1980)). In the end, the Court found that "medical necessity," which the defendant claimed as an affirmative defense, was not an implied defense to a charge under 21 U.S.C. § 841(a)(1), prohibiting marijuana trafficking. Because Congress expressly provided other exceptions in the drug-trafficking statute, but not one for "medical necessity," an implied common-law defense of medical necessity could not "succeed when the legislature itself ha[d] made a determination of values." Id. at 491, 121 S.Ct. 1711 (internal quotation marks and citation omitted). Thus, the Court held that "a medical necessity exception for marijuana [would be] at odds with the terms of the Controlled Substances Act." Id.
Nonetheless, in its earlier decision in Bailey, the Supreme Court acknowledged that Congress "legislates against a background of Anglo-Saxon common law" and that, as a result, it may be appropriate in some instances to recognize a commonlaw defense such as necessity, duress, or self-defense, even where the statute in question does not explicitly authorize the defense. Bailey, 444 U.S. at 415-16 n. 11, 100 S.Ct. 624.
Thus, while it is true, as noted in Oakland Cannabis, that a federal court is not entitled to rewrite a statute written by Congress to recognize a common-law defense, it still can conclude that Congress impliedly recognized the defense when enacting the statute. See Oakland Cannabis, 532 U.S. at 490-91, 121 S.Ct. 1711.
We take from these cases that any inquiry into whether a common-law defense to a federal criminal statute may be recognized must focus on the particular circumstances and in the end turn on whether it can be said that Congress contemplated the defense when it enacted the statute. See Bailey, 444 U.S. at 415 n. 11, 100 S.Ct. 624.
Consistent with these observations, we have held that a defendant may assert a justification defense to a felon-in-possession-of-a-firearm charge when the defendant faced an unlawful present threat of death or serious bodily harm. See United States v. Mooney, 497 F.3d 397, 406 (4th Cir.2007); United States v. Perrin, 45 F.3d 869, 873-74 (4th Cir.1995); United States v. Crittendon, 883 F.2d 326, 329-30 (4th Cir.1989). In Mooney, the defendant was a convicted felon who was, under the terms of 18 U.S.C. § 922(g)(1), prohibited from possessing a gun. When the defendant's ex-wife, however, placed a gun at his head, he grabbed the gun and called the police for the purpose of turning it in. Nonetheless, on the advice of counsel, he pleaded guilty to possessing the gun in violation of § 922(g)(1), believing that the statute did not provide a justification defense. Reviewing this conviction on the defendant's petition for a writ of habeas corpus, we held that if the proffered facts could be proved to a jury, "they would satisfy the *493 demanding criteria [for establishing a justification defense] set forth in Perrin and Crittendon, as well as the unanimous views of the other circuits, and [the defendant would] have been entitled to have the justification defense presented to the jury." Mooney, 497 F.3d at 404. As the Sixth Circuit has explained in similar circumstances, "[C]ommon sense dictates that if a previously convicted felon is attacked by someone with a gun, the felon should not be found guilty for taking the gun away from the attacker in order to save his life." United States v. Singleton, 902 F.2d 471, 472 (6th Cir.1990).
In this case, 18 U.S.C. § 111 makes it a crime for any person to forcibly assault or resist a federal officer, including a correctional officer. Just as an assault at common law could be justified by self-defense, we conclude it would not be inherently inconsistent to recognize the similar affirmative defense to a § 111 charge. But any such affirmative defense would have to be defined by the context of the prohibited conducthere, forcible assaults of prison officers committed in the prison context. One cannot ignore the reality that prisons are places where violent criminals are detained, presenting risks of harm far greater than exist on the outside. Consequently, any formulation of an affirmative defense to a violation of § 111 in the prison environment must take account of the government's penological interests. Numerous cases have recognized the delicate situation faced by correctional officers, who are required to make snap judgments regarding the "very real threats [that] unrest presents to inmates and prison officials alike, in addition to the possible harms to inmates against whom force might be used." Whitley v. Albers, 475 U.S. 312, 320, 106 S.Ct. 1078, 89 L.Ed.2d 251 (1986); see also Sandin v. Conner, 515 U.S. 472, 482, 115 S.Ct. 2293, 132 L.Ed.2d 418 (1995) ("[S]taff on the front line . . . daily encounter prisoners hostile to the authoritarian structure of the prison environment"); Hudson v. Palmer, 468 U.S. 517, 526-27, 104 S.Ct. 3194, 82 L.Ed.2d 393 (1984) ("The administration of a prison . . . is at best an extraordinarily difficult undertaking" (internal quotation marks and citations omitted)). Physical contact and force are inherent in maintaining order and providing safety. But this reality cannot deny the need for self-defense in the most serious of circumstances.
Accordingly, we recognize that in the appropriate case, federal courts may instruct the jury on a common-law justification defense to a § 111 charge based on self-defense, even though § 111 is silent on the issue.

B
The determination that a common-law justification defense may be available under 18 U.S.C. § 111 does not, however, define the scope of the defense or the contents of an appropriate self-defense instruction. While the government urges us to adopt the form of instruction approved in Perrin and Crittendon, the instructions in those cases were directed to the illegal possession of a firearm. Whether the same defense is available to a § 111 charge in the prison context requires additional analysis, taking into account the competing interests of the government in providing a safe prison environment and of inmates in defending themselves against excessive force.
Although an inmate's limited right to invoke self-defense in a prosecution under § 111 derives from common law impliedly recognized by Congress when enacting § 111, we are also influenced, in defining the scope of any affirmative defense of self-defense in the prison context, by Eighth Amendment jurisprudence. In addition, we recognize that an inmate, with his conviction, forfeits or has circumscribed *494 many rights and privileges afforded to other persons. See, e.g., Bell v. Wolfish, 441 U.S. 520, 545, 99 S.Ct. 1861, 60 L.Ed.2d 447 (1979) ("[S]imply because prison inmates retain certain constitutional rights does not mean that these rights are not subject to restrictions and limitations"). But this forfeiture of rights is not absolute. Indeed, the Eighth Amendment prohibition of cruel and unusual punishments inherently applies in the prison context, forbidding the "`unnecessary and wanton infliction of pain'" against inmates. Whitley, 475 U.S. at 319, 106 S.Ct. 1078 (quoting Ingraham v. Wright, 430 U.S. 651, 670, 97 S.Ct. 1401, 51 L.Ed.2d 711 (1977) (in turn quoting Estelle v. Gamble, 429 U.S. 97, 103, 97 S.Ct. 285, 50 L.Ed.2d 251 (1976) (in turn quoting Gregg v. Georgia, 428 U.S. 153, 173, 96 S.Ct. 2909, 49 L.Ed.2d 859 (1976) (joint opinion)))). Not every infliction of pain, however, is forbidden. "The infliction of pain in the course of a prison security measure . . . does not amount to cruel and unusual punishment simply because it may appear in retrospect that the degree of force authorized or applied for security purposes was unreasonable, and hence unnecessary in the strict sense." Whitley, 475 U.S. at 319, 106 S.Ct. 1078. Rather, "[i]t is obduracy and wantonness, not inadvertence or error in good faith, that characterize the conduct prohibited by the Cruel and Unusual Punishments Clause, whether that conduct occurs in connection with establishing conditions of confinement, supplying medical needs, or restoring official control over a tumultuous cellblock." Id. Thus, the determination of whether an Eighth Amendment violation has occurred through the use of excessive force in the prison context "turns on whether force was applied in a good faith effort to maintain or restore discipline or maliciously and sadistically for the purpose of causing harm." Id. at 320-21, 106 S.Ct. 1078 (internal quotation marks and citation omitted).
While the Eighth Amendment protects inmates from the unnecessary and wanton infliction of pain, § 111 protects federal officials from the violent assaults of, and resistance by, inmates. Congress enacted § 111 "to protect both federal officers and federal functions," as "Congress clearly was concerned with the safety of federal officers." United States v. Feola, 420 U.S. 671, 679, 681, 95 S.Ct. 1255, 43 L.Ed.2d 541 (1975) (emphasis omitted). With this concern, we understand § 111 to provide correctional officers with a shield against aggressive actions of inmates based on their subjective perceptions of excessive force or even on objective threats of slightly excessive force.
Any definition of an affirmative defense to § 111 must therefore be a narrow one, permitting the operation of § 111 to serve fully the needs of prison officials in maintaining an orderly and safe prison environment, even when maintaining such an environment will at times necessarily involve the application of force. It therefore follows that an inmate faced with forceful actions of correctional officers may only resist when he faces an unlawful and present threat of serious bodily injury or death, not when he feels oppressed and unreasonably believes that he might be facing excessive force. The Tenth Circuit explained well the need for this narrow definition:
To require less than the threat of substantial bodily injury in a prison environment, where physical contact between officers and inmates, (sometimes rough) is common and necessary, would poorly serve the Congressional concerns and the dual purpose of § 111 [to protect federal officers and federal functions]. To require only a threat of "bodily harm" would allow a prisoner to physically resist prison guards any time he "reasonably" believed the guard was exceeding the force necessary to maintain *495 prison or personal security. For example, such a rule would allow any prisoner to physically resist if the prisoner reasonably believed his handcuffs were too tight causing momentary interruption of his circulation. Guards would second-guess every use of force to ascertain whether the force used exceeded, even by a bit, what was necessary. Such a rule would threaten the efficient and safe function of the prison system. "The management by a few guards of large numbers of prisoners, not usually the most gentle or tractable of men and women, may require and justify the occasional use of a degree of intentional force. Not every push or shove, even if it may later seem unnecessary in the peace of a judge's chambers, violates a prisoner's constitutional rights."
United States v. Jones, 254 Fed.Appx. 711, 722 (10th Cir.2007) (unpublished opinion) (quoting Sampley v. Ruettgers, 704 F.2d 491, 494 (10th Cir.1983)); see also United States v. Gometz, 879 F.2d 256, 259 (7th Cir.1989) (upholding instruction in inmate's § 111 prosecution providing that "a defendant acts in self-defense when he reasonably fears that immediate serious bodily harm or death would be inflicted upon him if he did not commit the offense and had no reasonable opportunity to avoid the injury").
Accordingly, we hold that a prisoner charged with a violation of 18 U.S.C. § 111 must, to succeed on the affirmative defense of self-defense, demonstrate that he responded to an unlawful and present threat of death or serious bodily injury. Physical contact is a fact of everyday prison life, and to require a lesser standard of threatened harm would invite inmates to clash with prison officials every time they perceive a pat-down as too rough or a grip on their arm as too tight.
The judgment of the district court is accordingly
AFFIRMED.
NOTES
[*]  At common law, self-defense was a type of duress defense, which, as a class of defenses, was distinct from "necessity" defenses. See United States v. Bailey, 444 U.S. 394, 409-10, 100 S.Ct. 624, 62 L.Ed.2d 575 (1980). More recent cases have grouped the defenses of duress, self-defense, and necessity "under a single, unitary rubric: justification." United States v. Jones, 254 Fed.Appx. 711, 721 (10th Cir.2007) (unpublished opinion) (quoting United States v. Leahy, 473 F.3d 401, 406 (1st Cir.2007)). In the context of the issues presented here, we use "justification" and "self-defense" interchangeably.
