Always trust your gut instinct and put your own ambitions first.

Try to remember that everything happens for a reason and each & every memory a person carries with them is a potential source of valuable life experience.
One day you may be able to give advice to a heartbroken young person who has been forced to end a very close friendship or dating relationship because of religion or incompatible beliefs with the other person about religion.
If you felt that your own religious beliefs were incompatible with being in a relationship with your ex & you still feel this way without any doubts, you will soon start to shift your focus.
Away from memories of a failed past relationship and gradually move on, making a start towards paving the direction of the future life that you want.
If you broke up solely because you are dependent upon very strict religious hardliner relatives or very afraid of being targeted for harsh punishments by religious traditionalists who enforce compliance with opposite biological sex freemixing bans that you do not agree with, you have a very difficult choice to make.
Regardless of whether you keep in contact with your ex, you will need to decide whether you are willing to allow you future to be dictated by others whose lifestyle preferences you do not share.
It is almost certain that people who preach and pressure others not to make friends with those of the opposite biological sex or members of another religion are likely to have plenty of other religion connected 'thou shall nots' that they will impose upon other people just as enthusiastically.
Arranged marriage, employment, fashion choices, food & drink restrictions, university studies.
You need to decide whether you are willing to allow other people to control your life and dictate which of your ambitions you are allowed to try to fulfill.
Good luck!