The famous Rambam(Hilchos Geirushin 2:20) where he writes that if a man is required to divorce his wife (which were enumerated in Hilchos Ishus) and he doesn't want to divorce her ,beis din can force him to give a get. The Rambam writes that this get works is because forcing doesn't work only in a case when it has no connection to Torah observances(sale of land,presents). However,in this case it is his yetzer Harah which is stopping him and really he wants to fulfill his obligation.
My question is that the Rambam writes that this person deep down wants to be part of Israel and wants to keep the mitzvos. Do we say this about a man who became an apikores or mumar which does not fall intof the category of letiavon (for pleasure purposes) or the Rambam meant only in a case where the person is a shomer shabbas?