Joseph was a righteous man who endured some unrighteous acts. His moral integrity got him into more trouble than his sin. His masters wife attempted to seduce him and instead of lingering and having a rational conversation with her he fled
She caught him by his garment, saying, "Lie with me!" And he left his garment in her hand and fled, and went outside. (Gen 39:12 NAU)
Paul exhorts believers to Flee Immorality! Why? This sin is committed against the body as well as against the Lord. 1 Corinthians 6 spells out in detail how we are to relate to the world with our bodies. Being members of the Body of Christ our bodies are meant for the Lord not for the corrupting influences of the world. No matter how 'spiritual' you think you may be never trust your heart. Don't try to reason with you evil inclination it will win every time. Run! Forest, Run!