A safety is a device that blocks a part of the action to prevent the firearm from shooting until the safety is released or pushed to the "off" position. The safety is intended to prevent the firearm from being fired accidentally. However, safeties should never be relied on totally to protect against accidental shooting. Safeties are mechanical devices and subject to mechanical failure from wear and other factors, and can fail when least expected. Also, safeties can be bumped from the safe position unknowingly as your firearm is being handled or as it catches on clothing or tree branches.
How Safeties Can Fail
A safety is only a backup to safe gunhandling habits.