delivered the opinion of the court:
Following a bench trial in the circuit court of Cook County, the defendant, Oscar L. Williams, was found guilty of unlawful use of weapons in violation of section 24 — 1 of the Criminal Code (Ill. Rev. Stat. 1969, ch. 38, par. 24—1(a)(2)), of failure to obtain a State firearm owner’s identification card in violation of section 2 of the act of 1967 relating to possession of firearms (Ill. Rev. Stat. 1969, ch. 38, par. 83—2), and of failure to register the firearm with the city of Chicago in violation of chapter 11, section 1—7 of the Chicago Municipal Code. He was sentenced to 15 days in Cook County jail on the first charge, one year’s probation on the second charge, and fined $100 on the third charge. On appeal the appellate court reversed the convictions and remanded for a new trial. (11 Ill. App. 3d 1038.) The court found that the primary evidence against the defendant, an unregistered gun, was the product of an illegal search. We granted leave to appeal. Two issues are presented here: (1) Was the gun seized during an illegal search, and (2) Does the evidence establish unlawful use of a weapon beyond a reasonable doubt?
The facts of the case are virtually undisputed. On May 7, 1971, the defendant and his girl friend, Miss Katherine *241Floyd, plus the complaining witness, Mrs. Jewel Washington, and her friend, Miss Wendella Miles, were present at the residence of defendant’s cousin. An argument started between Miss Floyd and Miss Miles. The defendant told Miss Miles to “shut up” and slapped her. As a result of this blow she bumped into Mrs. Washington, who then demanded an apology from the defendant. When no apology was forthcoming, Mrs. Washington left to get her brother. At trial she testified that her purpose in getting assistance from her brother was to “fight” the defendant.
Following Mrs. Washington’s departure the defendant and Miss Floyd went to his apartment. Five minutes later the defendant noticed a crowd of about 25 persons in front of his apartment. In the crowd were Mrs. Washington and her brother. Fearing harm at the hands of what he considered a hostile mob, the defendant phoned the police. He then went outside. At this point he had a gun in his pocket. When Mrs. Washington’s brother asked him what he had in his pocket, the defendant removed the gun and said, “Anybody move, I will shoot them.” The defendant testified that during this confrontation members of the crowd were shouting and threatened to “whip him.” One person also stated that he was going to get a shotgun. Fortunately, no violence occurred. The crowd dispersed and the defendant returned to his apartment.
A short time later police officers responding to a radio call arrived. Mrs. Washington and others informed them that the defendant had assaulted them with a .22-caliber revolver. The police were directed to the defendant’s apartment by Mrs. Washington. They knocked on the door and were admitted by the defendant. Mrs. Washington identified the defendant as the man who had threatened the crowd, and the police placed him under arrest. At this point the officers had their guns drawn. The police searched the defendant and also searched a bag of dog food in the kitchen area of the apartment. A .22-caliber pistol was found hidden in the dog food bag on an open *242kitchen shelf which was between 7 and 10 feet away from the defendant. The gun was introduced into evidence at the defendant’s trial.
The appellate court reversed all three convictions, holding that the gun was discovered during an illegal search. The defendant also contends that the evidence was insufficient to prove him guilty of unlawful use of weapons. We shall examine this contention first.
Section 24—1 of the Criminal Code (Ill. Rev. Stat. 1969, ch. 38, par. 24—1) describes a number of acts as unlawful use of weapons. Defendant was charged with violating section 24—1(a)(2), which provides:
“(a) A person commits the offense of unlawful use of weapons when he knowingly: * * *
(2) Carries or possesses with intent to use the same unlawfully against another *** any *** dangerous or deadly weapon or instrument of like character.”
Williams argues that the evidence failed to show that he intended to use his gun unlawfully, and that the evidence in fact shows that he reasonably believed his use of the gun was necessary to defend himself and his dwelling. Section 7—1 of the Criminal Code (Ill. Rev. Stat. 1969, ch. 38, par. 7—1) states that a person is justified in the use of force against another “when and to the extent that he reasonably believes that such conduct is necessary to defend himself or another against such other’s imminent use of unlawful force.” Section 7—2 allows a similar use of force which is reasonably believed necessary to prevent an unlawful attack on a person’s dwelling. Justifiable use of force under either provision is an affirmative defense (Ill. Rev. Stat. 1969, ch. 38, par. 7—14) which must be raised by the pleadings or the evidence. Once raised, the State has the burden of proving the defendant guilty beyond a reasonable doubt as to that issue together with all the other elements of the offense. Ill. Rev. Stat. 1969, ch. 38, par. 3—2.
*243The issue was raised by the defendant’s evidence. We do not believe the State met the burden of proving beyond a reasonable doubt that the use of force was not justified. The defendant was confronted by a hostile mob of about 25 persons, apparently being led by Mrs. Washington, who, by her own admission, intended to “fight” the defendant. Threats were yelled at the defendant by persons in the crowd. That the defendant had a genuine fear of harm is confirmed by his call to the police for assistance. The State argues that despite the presence of an obviously hostile mob the defendant’s belief that force was necessary was unreasonable because the crowd was only standing in the street and was not advancing upon him. It also contends that it would have been more prudent for the defendant to remain in his apartment and await the arrival of the police. However, considering the foreboding atmosphere, the State failed to prove that the defendant’s acts were unreasonable. Had he waited until the crowd advanced before exposing his weapon, the risk of violence may well have increased. Moreover, there is no requirement that a person retreat before employing force in his defense. (People v. Horton, 4 Ill.2d 176.) For these reasons, the State did not prove the defendant guilty of unlawful use of weapons beyond a reasonable doubt.
We now turn to the question of whether the search which produced the gun was a legal search. Williams does not challenge the validity of his arrest. The sole question is whether the search incident to the arrest was beyond legal limits. The rule to be applied in such situations was announced in Chimel v. California, 395 U.S. 752, 23 L. Ed. 2d 685, 89 S. Ct. 2034: a warrantless search incident to an arrest may be made of the defendant’s person plus the area within his immediate control from which he might obtain either a weapon or an evidentiary item. (See also People v. Perry, 47 Ill.2d 402.) To apply the rule in this case we must consider the facts surrounding the arrest. The defendant was arrested in the kitchen area of his apart*244ment. The defendant’s girl friend was also present in the apartment but her location at the time of the arrest is unclear from the record. When the police made the arrest they had their guns drawn. After arresting and searching the defendant one of the officers reached into a dog food bag on an open kitchen shelf and found the defendant’s gun. This bag was the only item which was searched. There is no indication in the record as to what drew the officers’ attention to this bag. According to various estimates the dog food bag was between 7 and 10 feet away from where the defendant was standing. It also appears that in leaving the apartment the defendant would have passed the location of the bag.
The State urges that Chimel permits warrantless searches of areas from which a suspect might gain access to a weapon to use against the police. They contend that this area includes not only the area immediately within his grasp, but also extends to those areas into which he might have lunged to grab a weapon. A gun on an open shelf only 7 to 10 feet away from a defendant who has not been handcuffed or otherwise immobilized is, according to the State, clearly within lunging distance and thus presents a threat to the safety of the arresting officers. Two other factors are noted by the State to support the reasonableness of this search. These are the presence in the apartment of Williams’s girl friend, who herself might have reached for the weapon, and the fact that the police knew that the defendant had a gun shortly before the arrest.
The defendant argues that a shelf 7 to 10 feet distant is not within a person’s immediate control. He also contends that the arresting officers, who had their guns out, had the situation completely under control and any attempt to reach the bag would have been futile. The presence of a third person does not, the defendant argues, extend the permissible scope of the search. He notes that Justice White’s Chimel dissent, which would have allowed an expanded search when third persons were present who *245might have destroyed evidence, was not adopted by the majority.
Although we have not had occasion to consider the question of what area is within a person’s control and susceptible to a warrantless search incident to an arrest, courts in other jurisdiction have dealt with this question. The results have not been entirely consistent. In a series of Federal cases searches of areas not within a suspect’s immediate reach have been upheld. In most of these cases the arresting officers had reason to believe that the suspect was armed. In Application of Kiser (8th Cir. 1969), 419 F.2d 1134, the court upheld a search of the back seat of the automobile of a defendant known to be armed, made while the defendant was standing outside the car. The court noted that the back seat was “within leaping range” of the suspect. In United States v. Williams (D.C. Cir. 1971), 454 F.2d 1016, a search under the mattress of a bed in the room where the arrest occurred was upheld, the court noting that the defendant was known to possess a gun. Similarly in United States v. Wysocki (5th Cir. 1972), 457 F.2d 1155, a search of a closet 6 feet away from the defendant and of a box found within the closet was upheld. The arresting officers knew that the suspect had a prior armed-robbery conviction, and had been warned that his apprehension might be dangerous. In United States v. Manarite (2d Cir. 1971), 448 F.2d 583, the presence of third persons, plus the fact that a gun had already been found, were held to justify a search of the area within the control of the third persons.
In United States v. Patterson (10th Cir. 1971), 447 F.2d 424, the search of a kitchen shelf 4 to 6 feet away from the defendant was upheld. The court rejected the contention that the presence of five officers restricted the area of the search to the area within the defendant’s immediate reach. However, in United States v. Shye (6th Cir. 1973), 473 F.2d 1061, the court upheld a lower court ruling that a search behind a water heater 4 feet away from *246the defendant, who was standing against the wall, was unreasonable. The lower court had found that because of the presence of numeroiis officers, one of whom was standing between the defendant and the water heater, the area was not within the defendant’s control.
These cases make it clear, we think, that there can be no hard and fast rule defining the permissible scope of a warrantless search incident to an arrest. Certainly an arbitrary limitation to a certain number of feet would be unsatisfactory. Whether the search is reasonable .must depend on the particular facts of the case. Among the factors to be considered in this case are the knowledge that the suspect was armed, the presence of another person who might attempt to assist the suspect, the accessibility of the searched area, and the physical control of the situation exercised by the police. Judged by these standards, and considering the fact that the defendant would pass next to the shelf as he was being led from his apartment, we conclude that the trial court’s denial of the motion to suppress was not manifestly erroneous. (See People v. Clay, 55 Ill.2d 501; People v. Brooks, 51 Ill.2d 156; People v. Dailey, 51 Ill.2d 239.) Consequently, the gun was properly admitted into evidence.
For these reasons that portion of the appellate court’s judgment reversing defendant’s conviction for unlawful use of weapons is affirmed, and the reversal of the convictions on the other charges is reversed. The judgments of conviction and the sentences imposed on those charges are reinstated.
Affirmed in part; reversed in part.