I agree with those above that a protagonist HAS to have things that challenge them and make them falter - or else you will be left with an unbearable Mary-Sue. In my humble opinion it all comes down to the driving motivations. Take Hermione Granger, the purest of the pure, she hexes the sign up list for Dumbledore's Army and causes permanent boils to pop up on Marietta Edgecombe's face that spelled SNITCH (to keep the DA) and she mind-wipes her parents of any memory of her (also to keep them safe) and setting up Delores Umbridge to be attacked by centaurs. All could be seen as evil actions but the motivations behind them are pure (from a certain point of view) and lets be honest - Delores deserved it. It's all about making the action seem justifiable in the eyes of the audience.
It seems like your character tries to alleviate her best friend's pain as much as possible, fate just gets in the way - that doesn't make her evil, just unlucky.
So for making my characters do bad things … whoo buddy, yeah they do. One of my protagonists kills his brother in a sword fight. The brother has just assassinated the love of his life and if left alive, would kill his adopted infant daughter and the nursemaid. So he does it to protect the baby, but it's still fratricide. Then the daughter grows up and is definitely not afraid to protect herself. In one scene she kills three thugs who are threatening to "have their way" with her and another girl. In the scene afterwards, she is trying to scrub the blood from her hands and has a break down and this is what really humanizes her (beyond her justifiable motivation). I think the worst thing you can do is have your character move forward as if nothing has happened, that is where you move into psychopath territory and really start to lose your audience.
Hope this helped!