BRIDGEVILLE, Pa. — Tortured by loneliness and his lack of success with women, George Sodini developed a plan to get even. On Tuesday night, he executed it, opening fire in a fitness center here and hitting 12 women, 3 fatally, before turning a gun on himself.  Mr. Sodini, 48, described his anger and frustration in painstaking detail in notes he carried with him and left at his home and in a chilling online diary, offering an extraordinarily stark portrait of a killer’s motives. Officials said Mr. Sodini, of Scott Township, a suburb about six miles southwest of Pittsburgh, prepared for the assault for at least nine months, buying ammunition and at least three guns and making practice runs to the fitness center.  By the time he killed himself with a shot to his head a minute after the attack began, Mr. Sodini, who had no prior criminal record or known history of mental illness, had fired at least 36 shots from two 9 millimeter semi-automatic weapons, but never fully emptied either of the 30-round clips on the guns, or reloaded with the two full clips found in his bag.  “We don’t know why he stopped shooting, just thank God that he did,” said Charles Moffatt, the superintendent of the Allegheny County Police Department, which is leading the investigation. “He just had a lot of hatred in him, and he was hellbent on doing this act.”  Three of the nine injured women were still in serious condition on Wednesday at a local hospital, Mr. Moffatt said.  In his online journal, which has since been taken off the Internet, Mr. Sodini, a programmer-analyst at a local law firm, said that he had not had a girlfriend since 1984 and that he had not had sex since July 1990, when he was 29.  “I actually look good,” Mr. Sodini wrote in an entry dated Dec. 29, 2008. “I dress good, am clean-shaven, bathe, touch of cologne — yet 30 million women rejected me — over an 18- or 25-year period. That is how I see it. Thirty million is my rough guesstimate of how many desirable single women there are.  “A man needs a woman for confidence. He gets a boost on the job, career, with other men, and everywhere else when he knows inside he has someone to spend the night with and who is also a friend.”  At some point on Monday, Mr. Sodini updated his diary with his intention to finally go through with the attack — after he “chickened out” on another Tuesday in January — and he included his birth date and date of death: 8/4/2009.  Mr. Sodini’s writings and rationale are all too familiar, said Dr. Michael Welner, a forensic psychiatrist and adjunct law professor at Duquesne University in Pittsburgh, who has studied mass murderers.  “Mass shooters aim for the attention and notoriety of other mass shooters,” he said. “If you read this blog, it may explain to the reader why he feels hopeless, but it doesn’t explain why he decides to take the lives of innocent strangers, which is the point. He’s channeling that sense of masculine, sexual failure into a conquest that results in a mass killing.”  The attack took place in a “Latin Impact” aerobics class with about 22 women in it about 8:15 p.m. Tuesday at an LA Fitness center in a shopping center in Collier Township, about 12 miles southwest of Pittsburgh.  Mr. Moffatt said Mr. Sodini had not known anyone in the class, and chose it simply because it had a lot of women in it. Dressed in a black headband and black workout jacket and pants, Mr. Sodini walked casually in into the 30-foot-by-40-foot room.  He put his black gym bag on the floor and then fumbled around for his weapons, the police said. He then turned off the lights.  “He did not say anything,” Mr. Moffatt said of Mr. Sodini, who was a member of the fitness center. “He walked right to the room as if he knew where he was going and started shooting.”  The dead were identified as Heidi Overmier, 46, of Carnegie, Pa., director of group sales at Kennywood Amusement Park; Elizabeth Gannon, 49, of Pittsburgh, who worked in the radiation department at Allegheny General Hospital; and Jody Billingsley, 37, of Mount Lebanon, Pa., a sales representative for a medical equipment company.  Trish Cowen, who lived across the street from Mr. Sodini for 13 years, said he had been friendly but had largely kept to himself. “I never saw any women over there, and he wasn’t bad looking,” Ms. Cowen said. “I don’t understand it. I just assumed he was gay.”  In the Web diary, Mr. Sodini described his final preparations for the attack.  “I took off today, Monday, and tomorrow to practice my routine and make sure it is well polished,” he wrote. “I need to work out every detail, there is only one shot. Also I need to be completely immersed into something before I can be successful. I haven’t had a drink since Friday at about 2:30. Total effort needed. Tomorrow is the big day.”  He added: “Any of the ‘Practice Papers’ left on my coffee table I used or the notes in my gym bag can be published freely. I will not be embarrassed, because, well, I will be dead.”  Mr. Sodini owned his own home, which he bought for $78,000 in 1996. He said in the diary that he had assets of $250,000 and that he had recently been promoted.  In a July entry in his diary, Mr. Sodini took notice of a “beautiful college-aged girl” leaving Ms. Cowen’s home, apparently Ms. Cowen’s 22-year-old daughter.  “Right now my heart is just numb,” Ms. Cowen said. “What would have happened if he had a gun and my daughter had been out there?  “I’m just grateful he didn’t take it out on us when my daughter was here,” she said. “It is so tragic. You never would have thought, ‘Our neighbor,’ you know?”  A version of this article appears in print on , on Page A18 of the New York edition with the headline: Gunman Drew Dark Portrait of Loneliness Before Shooting Women. Order Reprints| Today's Paper|Subscribe
A man who killed three women and himself at a fitness center had planned the attack because of frustration over his inability to find a girlfriend, he wrote.