WIDENER, Circuit Judge:
This is an appeal from a conviction for receipt of a firearm by a convicted felon under 18 U.S.C. § 922(h)(1). On appeal, the defendant asserts that the court committed reversible error in admitting testimony that the defendant on a prior occasion had been seen in possession of a gun. We agree with the defendant, and vacate the conviction and remand for a new trial.
On or about June 13,1981, the defendant, while driving his wife’s car, was stopped by police who had a warrant to search the defendant’s home for drugs. The police searched the trunk of the car and discovered a .38 caliber pistol and a .32 caliber pistol. At trial, the defendant testified that he did not know that either gun was in the trunk. The defendant further testified that the .38 caliber pistol belonged to a passenger in the car and the .32 caliber pistol belonged to his wife. On rebuttal in the order of proof at the trial, the prosecution put on evidence that the defendant had been seen in possession of a pistol some time during the first part of 1981, before June of that year. That pistol was not, however, one of the guns found in the car when the defendant was stopped in June 1981, and the .32 found in the car and the subject of count 2 of the indictment was the same .32 the defendant was charged with receiving in count .1, also in June 1981.
Evidence of other crimes or wrongs is not admissible for the purpose of proving that the defendant possesses a criminal character or otherwise had the propensity to commit the crime with which he is charged. Fed.R.Evid. 404(b). Lovely v. United States, 169 F.2d 386 (4th Cir.1948), is our leading case. If offered for certain other purposes, however, such evidence is admissible if the risk of undue prejudice is outweighed by its probative value. See, e.g., United States v. Masters, 622 F.2d 83, 86-87 (4th Cir.1980) (evidence admissible as a part of a complete conversation showing the context of the crime and the setting of the case); United States v. Sparks, 560 F.2d 1173, 1175 (4th Cir.1977) (evidence admissible to prove knowledge and intent); United States v. DiZenzo, 500 F.2d 263, 265 (4th Cir.1974) (evidence admissible to prove knowledge and intent); United States v. Samuel, 431 F.2d 610, 612 (4th Cir.1970), cert, denied, 401 U.S. 946, 91 S.Ct. 964, 28 L.Ed.2d 229 (1971) (evidence admissible to prove knowledge).
The government argues that the evidence at issue was admissible to show guilty knowledge on the part of the defendant. This argument, however, must be rejected. The possession by the defendant of a different gun on a previous occasion has no relevance to the issue of whether the defendant knew on the day he was stopped that the two pistols were in the trunk of his wife’s car, or that he knew that the chattel he received and was charged with in count 1 was a pistol. But the commission of the same bad act on a previous occasion is bound to have had the effect of tending to show that the defendant had the propensity to commit the crimes for which he was on trial.
We therefore conclude that it was error to admit the evidence. Moreover, because it cannot be said with fair assurance that the verdict “was not substantially swayed by the error, Kotteakos v. United States, 328 U.S. 750, 765, 66 S.Ct. 1239, 1248, 90 L.Ed. 1557 (1946), we must vacate the defendant’s conviction and remand for a new trial.
VACATED AND REMANDED.
. The defendant as a convicted felon was indicted in count 1 for receiving the .32 caliber pistol, under 18 U.S.C. § 922(h)(1), and for possession of both the .32 and a .38 caliber pistol, under 18 U.S.C.App. § 1202(a)(1). The jury found the defendant not guilty of possession of the .38, and the court set aside a verdict of guilty of possession of the .32 from which the government does not appeal, so the defendant stands convicted only of the receiving charge.
No issue is made of the search of the trunk of the car to which Tate apparently consented.
. The evidence was not offered to impeach the defendant who had testified that he had never possessed a gun; rather, the district court took the position that there was no issue of knowledge unless the defendant claimed an innocent explanation of the presence of the guns in the trunk of the car. Consistent with United States v. Ling, 581 F.2d 1118 (4th Cir.1978), no issue is made that the evidence was admissible for impeachment purposes.