Would you betray your best friend if it resulted in them getting out of a horrible situation?

Would you do that? How would you react if your best friend did that?

context: your helping your best friend (or your best friend is helping you) to get out of a horrible situation by doing something that would betray their trust. You /best friend came clean after the fact.

question inspiration (what gave me the idea for this very question):

Updates
11 mo
Obviously a you or your best friend wouldn’t be doing something 100% unforgivable, more like a knife in the back.
Also the horrible situation is something your best friend/you know is hurting the other and they are blind to it (this betrayal act would result in getting them out of that situation), which would happen after the betrayer comes clean (tells the truth after the fact).
Would you betray your best friend if it resulted in them getting out of a horrible situation?
Post Opinion