Jeff Hanneman, a guitarist for the influential metal band Slayer, who helped shape the group’s sonic assault and wrote some of its most popular — and controversial — songs, died on Thursday at a hospital near his home east of Los Angeles. He was 49.

The cause was liver failure, according to the band’s Web site. The band reported in recent years that Mr. Hanneman suffered from a rare flesh-eating disease that doctors said he might have contracted through a spider bite.

Mr. Hanneman, who grew up in Southern California listening to Judas Priest and Iron Maiden, was still a teenager when he formed Slayer with another guitarist, Kerry King, in 1981. With Tom Araya on bass and Dave Lombardo on drums, Slayer began creating some of the darkest music and imagery in metal, conveyed with the furious finger work and nearly nonstop down-strumming that are often part of the subgenre known as thrash metal.

Mr. Hanneman wrote about serial killers and terrorists, rapists and dead women. The release of the band’s albums was sometimes delayed by record labels’ concern about graphic lyrics and cover art.