It's my fault my friend got raped

Me and this friend sadly don't talk anymore. When I was 20 and he was 22 (8 years ago) I had an extremely abusive ex boyfriend and he and his friends kept harassing me. My friend was staying at my house because my ex kept sending me death threats. My best friend was gonna protect me. I was in my bedroom and I heard someone kicking at my door. I ran and could tell it was my ex. My friend told me to hide so I did. I stayed in the closet and he was gonna call the police but my ex and his friends kicked the door in and were yelling asking where I was and my best friend said I wasn't here. I didn't have a phone and stayed in my closet. They came in my room and took my best friend and kept asking where I was and he kept saying I was out and I wasn't here. So my ex got mad and I looked away while they assaulted him and kept asking where I was and he was screaming and crying and saying I wasn't here. They destroyed my house before leaving and when they finally did I got out the closet and called the police. My friend was completely naked and on autopilot because he went outside naked and limping. He and walked off. I was in so much shock and panicking and crying. He tried to kill himself the following day and is in and out of mental hospitals. It's been 8 years and this was my fault. I shouldn't have asked him to stay with me. I stayed in my closet like a coward when he was willing to help me I didn't help him. I hate myself everyday for it because it should have happened to me. I should never have dragged him into this and I destroyed and broke him. I'm just as bad.