Tupac himself used to be a devout Muslim. He battled with his religion his entire life, switching from Islam to Christianity, to Islam, then near the end proclaimed he claimed no religion, he just prays directly to God.
Tupac introduced many of the outlawz to Islam, by giving them a Quran. Not trying to convert them as he wasn’t a muslim himself at that time period. He told them to study it if they wanted to understand life, he also told them to study the bible. None of them converted until long after his death however.
Here is Tupac in a radio interview before he was famous, when he was 16 years old. This was when he was the national chairman of the New African Panthers. The interviewer is asking him how he managed to stay away from drug use and keep his head clean when all his peers have fallen to that life, you’ll notice the young Tupac starts his answer by saying “All praise due to Allah”.
We know a few years after this interview he turned away from Islam for whatever reason, but he remained defensive of it. Only he knew what he truly believed inside, however he would never let anyone disrespect Islam or be involved in anything that is seen as disrespectful towards Islam, even if he now drank smoked and turned his back on the teachings.
The entire fight with the huges brothers getting himself kicked off the film menace to society – was over perceived disrespect towards Muslims. Most people don’t know that. The role they wanted Tupac to play was a Gangster Muslim, Tupac protested saying there is no such thing as a Gangster Muslim, they do not exist. If Gangsters believe they are Muslim, then they are mistaken, you cannot be both, he said. Maybe that’s why he stopped calling himself a Muslim, maybe it has nothing to do with lack of faith but rather he no longer believed he earned the right to call himself one. None the less, that what enraged him and that’s why he got replaced from the film. He says it here himself.