How do I finally let go of a toxic first love ex for good?

My ex and I broke up last year, over a year now actually. Still I have feelings for him even though he was absolutely terrible in the end. He is trying to get back together now but I need to cut contact again and let him go for my own mental health. I don't believe that he has changed to the point of being able to love me properly.

I think I'm having so much trouble getting over him because he was not only my first relationship but my first and for a while I really did want to marry him. He was genuinely amazing until I first looked through his phone and found inappropriate messages. After that he slowly became a different person.

I really hate that I have feelings for him bc logically I shouldn't love someone who has hurt me how he did emotionally or physically.

I feel like Like I'm mostly over him but I still struggle at times.

Updates
9 d
Forgot to mention. Without getting involved in another relationship.
How do I finally let go of a toxic first love ex for good?
Post Opinion