In this week’s parasha, Vayeshev, we read a detail-laden, dramatic story that has the power to teach us an important lesson about the faith of man in his own plans, and the way God directs history through man’s actions – but not necessarily according to man’s plans.We read of the 12 brothers, Jacob our forefather’s sons, and of the warm and preferential treatment Joseph gets from his father. This alone is enough to cause his brothers to be jealous of him. In addition, Joseph whispers negative rumors about his brothers to his father.But what most makes Joseph’s brothers hate him is when he tells them about two dreams he dreamt, which are interpreted to mean he will rule over his brothers in the future and that they will bow down before him. The preferential treatment, the slander and the royal dreams all bring the brothers to a difficult decision: this “dream boy” has to disappear from the scene.At the beginning, they plot to kill him, but after discussing it among themselves, decide to throw him into a pit. Finally, he is sold to a convoy of foreign merchants, who take Joseph with them to their country.Thus, the brothers hope the dream will be gone and Jacob’s preference for Joseph over them will disappear as well.The Torah does not hide this difficult story. It tells it in detail, so we can learn from it about living an honest lifestyle.Do the brothers succeed in their scheme? At the beginning, it seems they do. The foreign merchants take Joseph with them and sell him to an Egyptian minister. Joseph, the Hebrew slave, turns out to be a success in everything relating to running his master’s house.But following a mean and nasty libel about him, he is thrown into an Egyptian prison, where he spends many long years.Joseph, the favorite son with the royal dreams, is thrown somewhere in a foreign prison with no one caring about his fate. His father is sure he was killed under strange circumstances.There is no negotiation for his release, and his future looks bleaker than ever.His situation reminds us of a Talmudic saying which means, a fall from a tall mountain into a deep hole.Unquestionably, this was a very grim situation.But toward the end of the parasha, there is a twist in this sad story. Pharaoh, the king of Egypt, impulsively sends two of his ministers to prison. There, they dream strange dreams and search for interpretations.And who turns out to be a great interpreter of dreams? The foreign and miserable prisoner, Joseph.The parasha ends at this point, leaving us hanging in anticipation of the story’s continuation, but we will soon find out its ending and learn lessons for our lives in the here and now.The continuation of the story is that after Joseph spends two more years in the Egyptian prison, Pharaoh also dreams a strange dream and searches for an interpretation. Only then does the Egyptian minister – who had been in prison with Joseph but had since been released – remember the jailed Hebrew slave, the excellent dream interpreter. Pharaoh gets Joseph’s interpretation of his dream and hears advice from him on how to correctly administer his kingdom.At the next stage, Pharaoh appoints Joseph as a viceroy. Sometime later, Joseph’s brothers come to Egypt and bow down before… yes, before the king’s viceroy, their younger brother Joseph.Now, we see that the brothers did not succeed at all in their desire to rid themselves of Joseph, and thus erase his royal future. But even more so, how did the story develop to the point that Joseph ruled in Egypt and his brothers bowed down before him? The same brothers who wished to get him out of their way! It was actually they who, by their deeds, led Joseph to arrive in Egypt.They wished to harm, but the action itself brought about his success! We often meet people who plan to inflict harm on others, perhaps due to jealousy, competitiveness or petty envy.Sometimes, it even seems that they succeed. But this is what the Torah comes to teach us: Man does not control the results of his actions, and even when he means to harm, God can make it so that the action itself leads to completely opposite results.This is what the Gemara teaches us (Shabbat 119, 71) about “Joseph Respects Shabbat,” so named because despite being desperately poor, he would borrow money in order to respect and enjoy Shabbat. This Joseph had a rich and prosperous gentile neighbor. One day, stargazers informed this gentile that his Jewish neighbor was going to take all his assets from him.The man got very worried, deciding to sell all his assets and use the funds to purchase a large diamond, which he would take with him everywhere, sewn into his hat. This way, he thought to himself, he would protect himself from the Jew who was plotting to take all his assets.One day the man walked across a bridge, and a strong wind blew his hat into the water. A fish came along and swallowed the hat. That same fish was caught in a fisherman’s net about an hour before Shabbat. The fishermen wondered who would buy such a big and expensive fish so close to Shabbat? They went to Joseph Respects Shabbat thinking he would be happy to do so.Joseph indeed purchased the fish with his last coins, and was happy that he was able to fulfill the mitzvah and delight in Shabbat. When he opened the belly of the fish, he of course discovered the diamond the fish had swallowed, and the joy in his home was great. After Shabbat, he sold the diamond and became an incredibly wealthy man.An old man met him and said, “He who borrows in order to respect Shabbat – Shabbat pays back his debt.”Why did the sages need to tell the story of Joseph and his gentile neighbor? They could have made it shorter and said: Joseph would respect Shabbat with all his might. One day, he bought a fish, found a diamond in it and because he had borrowed money in honor of Shabbat, merited such wealth.Why did the story have to include the details of how the diamond got into the belly of the fish? The sages wanted to tell us that man cannot act against God’s will.Actually, he is the cause for the will’s implementation. That same gentile who heard his assets were going to go to a Jew tried to oppose and fight the decree. God said: You want to fight? Please, this fight will only help fulfill My will. It will actually shorten the process – rather than transfer all the assets, land and properties all over the world, he collected it all in one stone.Our grandmothers often repeated the old Jewish saying, “Man plans and God laughs,” or as it says in Proverbs: “There are many thoughts in a man’s heart, but God’s plan – that shall stand.” Faith in God is the key to facing our enemies. This is true when it is our private enemy, but it is doubly true when there is an enemy who boasts and threatens that he will destroy the Jewish nation living in the Land of Israel.We are sure that God will “take care” of things and ultimately, we will all see how the deeds of an enemy that stem from bad intentions will themselves lead to positive and beneficial results for all of Am Yisrael.The writer is rabbi of the Western Wall and holy sites.