Tasers

Tasers are used by law enforcement officers as an alternative to guns to capture potentially violent suspects without anyone getting hurt. How do these stun guns work? Are they safe?