Risk in any complex technology is unavoidable. However, important lessons can be learned from accidents which can be used to design procedures for reducing risk in the future. Although descriptions of the Therac-25 medical electron accelerator accidents have been published previously, they are incomplete and often misleading. This paper contains a detailed account of these accidents, along with some lessons that can be learned from them in terms of system engineering, software engineering, and government regulation of safety-critical systems involving software.