Although Hashem had warned Bilam numerous times that he was forbidden to curse the Jews, Bilam thought he could coax Hashem. So to, Bilam told Balak to build seven alters which he would make sacrifices to Hashem on. Ironically, Hashem accepted his sacrifices! WHAT? Despite the fact that Bilam offered the sacrifices to Hashem with impure intentions, Hashem nevertheless accepted them, and even rewarded Bilam and Balak (Ruth-the meshiach is from her dynasty- is a descendant of Balak and Bilam ends up blessing the Jews instead).
From this strange turn of events, we learn that although Bilam and Balak were performing a mitzvah with evil motivations, they nonetheless performed the deed. The idea behind this concludes that perhaps one day, their motivation would lead to sanctifying Hashem’s name.
Although at times, we may not feel as connected to Hashem and Judaism as we wish to be, especially during the toughest of times when we feel the most disconnected, those are the times that our mitzvot shine the brightest. It is easy to be a committed Jew when you are feeling inspired. The challenge however is following Hashem’s mitzvot when you feel completely disconnected. Surprising enough, this recognition can shed much light to your own observance and it can even push you to become re-inspired! The trick is recognizing that Hashem puts us all through many challenges and tests to see if our trust in Him is more powerful than letting our personal distress run our lives. Although we may feel we are 'faking it' at times when we push ourselves to observe Hashem's commandments when we fill completely disconnected, in actuality we are developing ourselves and we are strengthening our connection to Hashem.