They do both, depending on who is holding the gun.
Guns prevent crime.
Reportedly 500,000 Americans use a firearm to defend themselves from acts of violence every year. But no one knows how often guns are used to thwart crime because those acts are not reported. Dr. John Lott in his book More Guns, Less Crime does document the thesis of the book title with statistical analysis. Guns also are used to commit crimes when in the hands of criminals. A look at Richmond, Virginia provides an answer.