Cutting my ex out

I had to cut my ex out of my life. I was completely in love with him, but he just didn’t want to date the same person over and over again. I couldn’t get over him if I kept talking to him. It hurt to talk to him. So I had to cut him out for my sake. I feel horrible because he was also my best friend. I feel selfish. I feel like I was only thinking about me. But I just couldn’t do it anymore. I feel relieved. I feel like I won’t have to hurt about him. Am I selfish for doing this..? 😔