I think we simplify why people cling to religious identity. In Africa, the ones who didn't have a strong religious identity were converted by the European colonizers. The Muslim population stuck to religion as an identity (nationalism came in much later, and is an amorphous concept). 

The ones who stick to their religion don't integrate, or more importantly get a modern education. That begins a vicious circle of social immobility, and sticking to religion. However, looking down on someone's religion does not make them less religious. Accepting them does. India, for instance, allows religious laws to apply for marriage and inheritance, if a Muslim chooses to (there are civil laws, which apply according to ones choice). 

Along with the vote, that is a large reason that ISIS has more members from most western countries, despite India having 180 million Muslims (France has 5 million Muslims, and over 1000 members in ISIS, India has 60; Canada has over 100, USA has over 300).