delivered the opinion of the court.
After a bench trial, defendant, Jose Rodriguez, was found guilty of aggravated battery, armed violence and unlawful use of a weapon by a felon as a result of the shooting of the victim, Edward Cervantes. Defendant was sentenced to six years’ imprisonment on the armed violence offense, which merged with the aggravated battery conviction, and a concurrent five years’ imprisonment on the unlawful use of a weapon offense. He appeals his aggravated battery and armed violence convictions.
Edward Cervantes testified to the following for the State. On October 23, 1986, around 1 a.m., he and about seven fellow members of the Latin King Cobras street gang were passing the intersection of 107th and Calhoun Streets in Chicago on their way to buy liquor. The Cobras had left a wake of a fellow gang member at approximately 10 p.m. the preceding evening and had thereafter begun drinking beer and schnapps. As they approached the intersection of 107th and Calhoun, the Cobras saw four or five other youths, including defendant and Andrea and Mario Espinoza, on the southeast comer. At that time, defendant ran downstairs and Mario ran upstairs into a walk-up at 10703 S. Calhoun. When the Cobras reached the youths remaining at the intersection, they began shaking hands with them. However, Andrea Espinoza went up to Cervantes, shoved him and told him to get the hell out of there. Cervantes and Andrea then began fighting. Within a few seconds, Andrea turned and ran into the same walk-up as defendant had gone into earlier.
*487Not being deterred by Andrea’s flight, Cervantes gave chase. However, he was stopped short by the appearance of defendant and Mario, who were carrying shotguns. Cervantes, who was then about eight feet away from the pair, began to back away from them. While he was doing so, defendant shot his weapon twice. The first shot hit the ground in front of Cervantes. The second round hit Cervantes in the right thigh. Neither Cerantees nor any of his friends were armed with any weapons. The area of 107th and Calhoun was turf of a street gang called the Party People Organization, of which the Espinozas and two of the boys with them, Omar Diaz and “Andy,” were members. Two of Cervantes’ cohorts, Rodney Roberts and Louis DeLeon, substantially corroborated his version of the shooting, the latter in rebuttal.
Chicago police officer Mike Migliano also testified for the State. After the officer arrived at the scene, he arrested defendant, who was lying on the roof of the building adjoining 10703 South Calhoun. After being transported to the police station, defendant admitted shooting Cervantes because he feared that Cervantes was going to harm him. However, defendant did not tell Migliano that Cervantes had a weapon. Defendant also admitted having buried the shotgun in his backyard. Thereafter, Migliano transported defendant back to the scene and recovered the shotgun from under some shrubbery and dirt.
Andrea Espinoza, called as a witness for Mario, who was tried jointly with defendant, gave the following testimony relevant to the State’s case against defendant.
Mario and Andrea left work, at midnight on October 22, 1986. After they arrived home, two boys approached Mario, Andrea and a couple of their friends. One of the two, who was a Latin King Cobra, began “flashing” a gun in his belt. While Mario and Andrea were standing in front of their apartment, some other boys emerged from the “projects” across the street and threatened to get them because they were insulting their dead friend. Cervantes then began hitting Andrea with a chain. As soon as Andrea was hit, he fell to the ground and covered his head with his hands. Other people then began to hit and kick him. The beating lasted two to three minutes. While he was being beaten on the ground, Andrea heard two gunshots. Thereafter his attackers ran off. Neither Andrea, Mario nor defendant belonged to any street gang. Defendant was not outside with Mario, Andrea and their friends. Andrea surmised that Cervantes was one of the boys who was beating him when the gunshots rang out but subsequently retracted this statement. Andrea received *488only bruises from the beating and did not seek medical treatment. He did not see defendant with a shotgun that night. While they were beating him, Andrea could see the Cobras holding cans of beer.
Defendant’s wife, Leticia, testified that defendant, who had been home since 6 p.m., and she were watching television in their basement apartment at 10703 South Calhoun on October 23, 1986, at about 1 a.m. At that time, they heard a loud commotion outside. Defendant looked out and told Leticia there was a bunch of people outside. Defendant then went to their bedroom, pulled a gun from under the mattress and left the apartment.
Defendant testified that after obtaining the shotgun from under the mattress he went outside to see what was going on. When he got outside, defendant saw Andrea laying on the ground while being beaten by some people, including the victim. Defendant stated that when he saw Andrea being beaten, he panicked, saw “one of the guys” reaching into his jacket for what he thought was a weapon and was trying to protect his family and Andrea at the same time. When asked where this person was in relation to Cervantes, defendant stated, “They were all together.” Defendant also testified that he was afraid that the people beating Andrea would go into his house. Defendant admitted firing the shotgun twice into the ground. Defendant denied belonging to any street gang.
On cross-examination, defendant testified that he was standing at the fence of his building for about a minute or two before he fired. He also admitted that he was the only person with a weapon. Defendant further stated that he “tried to scare them but they wouldn’t go away.” When asked if he hit Cervantes with his second shot, defendant stated that he “didn’t see because a lot of people fell over where they were running.” He also testified that Cervantes and his friends were beating up Andrea, who was on the ground, when he fired the shotgun. When asked whether the pellets which he fired hit only Cervantes and a young woman with the Cobras, defendant responded that he “didn’t see it.” Defendant also testified that the crowd of people attacking Andrea surrounded the house after his first shot. But after testifying that only “[sjeconds” separated the first and second shots, defendant stated that they surrounded the house after the second shot. Defendant further testified that between the first and second shots the crowd surrounded him and he threw the gun away. Defendant denied that Cervantes was backing away when he fired the second shot.
In announcing it verdicts, the trial court first found that defend*489ant was not outside when the trouble between Cervantes and Andrea Espinoza began. Addressing the reasonableness of defendant’s belief in the necessity to use force as it related to the unlawful use of weapon offense, the court then found that there was no immediacy in the situation defendant encountered necessitating his going outside and using the shotgun. Addressing defendant’s self-defense theory as it related to the armed violence and aggravated battery charges, the court found no immediacy in the threat which Cervantes posed to defendant because defendant could have retreated back into the house.
On appeal, defendant contends that his belief in the need to use deadly force to prevent imminent death or great bodily harm to Andrea was reasonable. (Ill. Rev. Stat. 1985, ch. 38, par. 7 — 1.) Defendant concedes that, if the testimony of the State’s witnesses was truthful, his use of force would have been unreasonable. However, he argues that his witnesses were more credible. The trial court, defendant notes, did not believe Cervantes’ testimony that defendant was outside when Cervantes and Andrea fought. Defendant also argues that the trial court erred in ignoring his testimony that he saw Andrea being beaten while lying on the ground and, instead, relying upon the lack of any immediacy in the situation given Cervantes’ distance from defendant and defendant’s failure to retreat.
A person may use deadly force to protect himself or another if he reasonably believes that he or the other person is in imminent danger of death or great bodily harm. (Ill. Rev. Stat. 1985, ch. 38, par. 7 — 1.) The privilege exists even though the person is mistaken or the danger is only apparent. (People v. White (1980), 87 Ill. App. 3d 321, 409 N.E.2d 73.) The test is what the defendant, as a reasonable man, believed under the circumstances. (White, 87 Ill. App. 3d 321, 409 N.E.2d 73.) Before addressing the merits of defendant’s argument, we must also remind him that it is the correctness of the trial court’s judgment, not its rationale, which is the subject of appellate review. (People v. Norks (1985), 137 Ill. App. 3d 1078, 484 N.E.2d 1261.) As such, we may sustain the judgment on any ground appearing in the record, regardless whether the trial court’s reasoning was incorrect (People v. Merz (1984), 122 Ill. App. 3d 972, 461 N.E.2d 1380) or whether that ground was relied upon by the trial court (People v. Bolden (1987), 152 Ill. App. 3d 631, 504 N.E.2d 835).
In view of the foregoing, we disagree with defendant that *490the trial court erred in finding him guilty of the offenses charged. As defendant notes, there is no duty to retreat before one is entitled to defend himself or another. (People v Hughes (1977), 46 Ill. App. 3d 490, 360 N.E.2d 1363; People v. Millet (1965), 60 Ill. App. 2d 22, 208 N.E.2d 670.) As such, the trial court erred in relying on defendant’s failure to retreat to find no “immediacy” in the situation he faced.
That error notwithstanding, defendant’s testimony was inadequate, either alone or when viewed in light of other defense evidence, to show that his belief in the need to use deadly force to protect Andrea was reasonable.
Specifically, defendant’s testimony that he. was standing at the fence of the apartment building for about a minute or two before he fired contradicted his testimony that, when he got outside, he saw Andrea lying on the ground while being beaten and “panicked.” Also, defendant’s admission that he was the only person with a weapon contradicted Andrea’s testimony that Cervantes was beating him with a chain. Significantly, defendant never mentioned or alluded to a chain in his testimony.
Moreover, as defendant does not contend that he fired the shotgun in self-defense, the fact that he saw a person reach into his jacket for what he believed to be a weapon is of no avail absent any testimony that he believed the weapon would be used against Andrea. Similarly, because defendant does not contend that he used the shotgun out of fear for his family or dwelling, the fact that he was “trying to protect his family” is also of no avail to him. In this regard, we find both the fear of the person who reached into his jacket and the fear that the crowd would invade his home to be merely products of defendant’s imagination and not based on any reasonable belief. See People v. Limas (1977), 45 Ill. App. 3d 643, 359 N.E.2d 1194.
Defendant’s claim that the crowd surrounded the house after his first shot was also relevant to the reasonableness of his belief in the necessity to fire again. However, the conclusion that this had not, in fact, occurred was amply supported by his admission that only “[s]econds” separated the first and second shots and that the crowd surrounded the house after the second shot. Thus, defendant had no more reason to believe that anyone was threatened with death or great bodily harm at the time of the second shot than at the time of the first. Moreover, it was a reasonable inference from defendant’s testimony that the Cobras posed even less of a danger after the first shot. Defendant admitted that he “didn’t see” *491whether he had shot Cervantes because a lot of people were running and fell at that time.
Defendant’s own testimony, in toto, fails to convince us that he had a reasonable belief, i.e., the belief of a reasonable man, in the need to use deadly force to defend another under the circumstances of this case. The defense evidence itself revealed beyond a reasonable doubt that any danger to Andrea which defendant apprehended, whether actual or apparent, was wholly insufficient to warrant the use of deadly force against it.
Beyond the fact that defendant’s convictions are amply supported by the inadequacies in his testimony and the other defense evidence, the guilty verdicts are unassailable to the extent that they reflect a credibility determination. It is the function of the trier of fact to determine the credibility of the witnesses and the weight to be given their testimony and its determination will not be disturbed where the evidence is merely conflicting. (People v. Franklin (1985), 130 Ill. App. 3d 514, 516, 474 N.E.2d 776.) In performing that function, a trier of fact is free to accept one part of a witness’ testimony and reject another. (People v. Little (1974), 18 Ill. App. 3d 1081, 1085, 311 N.E.2d 173.) The fact that the trial court did not believe Cervantes’ claim that defendant was outside when he and his cohorts approached did not mean that it was required to accept defendant’s version regarding the circumstances of the shooting itself. See People v. Young (1973), 11 Ill. App. 3d 609, 615-16, 297 N.E.2d 298.
For all of the foregoing reasons, we affirm defendant’s convic- ' tions for aggravated battery and armed violence.
WHITE and CERDA, JJ., concur.