In Parshas Matos (31:14), the Torah relates that when Bnei Yisrael returned from battle with the Midianites, Moshe Rabbeinu got angry with the officers of the army for sparing the Midianite women. Later, the posuk says that Elazar informed the soldiers that any utensils captured from the Midianites must first be kashered before using them (31:21). Why wasn't Moshe Rabbeinu the one to instruct the soldiers about the halachos of hechsher keilim? Chazal explain (see Rashi there) that "one who gets angry makes mistakes." When Moshe unnecessarily got angry at the soldiers, he forgot the halachos of hechsher keilim; Elazar therefore had to remind everyone of their details. Similarly, when Moshe got angry at Bnei Yisrael for complaining about the lack of water, that caused him to make the mistake of hitting the rock (Chukas 20:10-11). And when he got angry at Elazar and Isamar after the deaths of Nadav and Avihu, he made a mistake regarding the halachos of eating korbanos.
Why does unwarranted anger lead a person to make mistakes? When a person gets angry, he becomes self-absorbed and loses control of himself, and that prevents him from thinking clearly. Such a person will forget his knowledge and make errors in judgement. Chazal comment (Midrash Tanchuma, Bamidbar 1:6) that one who does not make himself "hefker k'midbar" (free and open like a desert) will not be able to truly acquire Torah. In order for a person to reach the truth in his Torah study, he cannot have any personal agenda. He must approach his learning with objectivity and intellectual honesty. Only then will he be willing to accept the truth from anyone and not be tempted to favor his own interpretations. If a person is overtaken by self-interest, his mental vision will become clouded and that will cause him to make mistakes. For the same reason, one who gets angry will stumble because without the proper mental equilibrium, one cannot think clearly and objectively.
Chazal take this idea one step further. The Gemara says (Shabbos 105b):
One who tears his clothing in anger, or breaks his utensils in anger or scatters his money in anger should be considered in your eyes like one who worships idolatry, because this is the approach of the yetzer hara: today it says, "Do this"; and the next day it says, "Do this," until ultimately it tells him, "Go serve avodah zarah." Said Rav Avin, "Which posuk alludes to this notion? 'You shall not keep a foreign god in your midst (Tehillim 81:10).'"
From this statement of Chazal it would seem that one who gets angry is compared to an idolater because if he gives in to his evil inclination and loses his temper today, eventually he will be drawn to serve avodah zarah. But the Zohar (Bereishis 1:26) formulates this idea even more strikingly. It says simply, "Whoever gets angry is like one who serves avodah zarah." This implies that losing one's temper itself is like serving avodah zarah. Why is that?
Perhaps the answer is that anger, more than any other negative emotion, demonstrates a lack of spiritual focus. In a fit of anger one can lose himself to the point that he will behave or speak in ways that he will later regret terribly. He simply cannot contain himself. A person who is out of control loses his awareness of Hakadosh Boruch Hu. He submits to the whims and wishes of his yetzer hara, the "foreign god" within himself. That is why he is compared to an idol worshipper.
This idea can help clarify another puzzling statement of Chazal. The Gemara (Kesubos 110b) says that one who lives outside of Eretz Yisrael is also considered like an idol worshipper. What does this mean? The Meiri explains that Eretz Yisrael is a place of Torah wisdom and yiras shamayim. It is a wholesome spiritual environment that is conducive to serving Hakadosh Boruch Hu. One who chooses to live in Chutz La'aretz can't help but lose some of the extra "Hashem awareness" that he would have were he to live in Eretz Yisrael. As such, by distancing himself from Hakadosh Boruch Hu, the one who lives in Chutz La'aretz is similar, relatively speaking, to the idol worshipper who has lost his spiritual focus.
How can one who lives outside of Eretz Yisrael maintain a proper spiritual perspective and strengthen his connection to Hakadosh Boruch Hu? One way is by engaging in talmud Torah. The Gemara (Brachos 8a) says, "From the day the Beis HaMikdash was destroyed, the only place Hakadosh Boruch Hu has in His world is the four cubits of halacha." When the Beis HaMikdash was standing, that was the primary location of the Shechina. But after the Beis HaMikdash was destroyed, the primary residence - the bayis, so to speak - of the Shechina, is in a beis midrash where Torah is studied.
It is through Torah study that one can develop a closeness to Hakadosh Boruch Hu even without a Beis HaMikdash. As the Gemara says (Megillah 29a) "I have been for them a mikdash me'at (a miniature Beis HaMikdash); said Rav Yitzchak - this refers to the synagogues and study halls of Bavel." The batei knesses and batei midrash in the exile are like miniature batei mikdash. They are places of Talmud Torah and tefilla, where one can still feel a special closeness to the Shechina, similar to the feeling one experienced in the Beis HaMikdash.
Certainly, the ideal way to connect with Hakadosh Boruch Hu is by living in Eretz Yisrael, where the kedusha of the Shechina is most palpable. But for those living in Chutz La'aretz, there still is a way to tap in to the kedusha of Eretz Yisrael, and that is by intensifying our efforts in talmud Torah and tefilla. Our ongoing dedication to talmud Torah and tefilla can protect us from the destructive force of anger and help us keep Hakadosh Boruch Hu at the center of our lives.