In this week’s Torah portion, we read one of the most dramatic stories in the Torah. The story of the sale of Joseph begins this week and continues over the next few weeks until its surprising conclusion, when the tables are turned and Joseph, the hated and demeaned teenager, becomes the leader of his family and all of Egypt.But let’s not get ahead of ourselves. Let’s read the story in order. In short: Jacob our Patriarch has 12 sons, one of whom – the 17-year-old Joseph – is his favorite. This leads to his brothers’ jealousy. In addition, Joseph adds to their hatred of him when he tells them about the dreams he dreamed in which he ruled over the entire family. The brothers’ deep hatred bursts forth in a terrible act when they sell him into slavery. Joseph is brought down to Egypt and sold to one of Pharaoh’s ministers. Afterward, following a despicable libel made up by that minister’s wife, he is thrown into an Egyptian prison cell. He languishes in prison, his future obscure; actually, his future is certain – to rot in the Egyptian prison until the day he dies, alone, lacking basic rights, and with no one even finding out about his bitter fate.And then a rare opportunity presents itself. An Egyptian minister is thrown into jail and, three days later, is slated to be released, to return to his lofty position. Joseph begs him not to forget about him when he returns to serve Pharaoh, Egypt’s exclusive ruler. Joseph asks him to whisper into Pharaoh’s ear about the innocent young man rotting in prison.One can imagine the situation. The righteous Joseph falls at the feet of the chief butler and begs, “But remember me when things go well with you, and please do me a favor and mention me to Pharaoh, and get me out of this house. For I was stolen from the land of the Hebrews, and here, too, I have done nothing that they should put me into the dungeon.”A thin ray of hope appears in Joseph’s heart. Maybe, maybe there is someone left who still cares about justice. Maybe there is someone who will be moved by the suffering of a young man. Maybe I can still have a better future.Two years later, that minister remembers the boy thrown into the dungeon. He mentions him to Pharaoh who, shockingly, releases him from prison and promotes him to greatness. We’ll read about this next week.THE SAGES of the Midrash asked the following interesting question: Since this entire extraordinary story was Divine planning in order to actualize Joseph’s monarchy and bring Jacob and his family down to Egypt, why did Joseph have to suffer for two additional and unnecessary years in an Egyptian prison? Why didn’t that Egyptian minister remember to have him released right after he was asked to?The sages’ answer is worth examining. They answered that Joseph trusted that minister when he asked him to remember him, and for that he was punished with two additional years in prison!This answer is incredibly perplexing. What did Joseph ask for? Just to see the light of day, to leave prison for a life of slavery. Nothing could be more legitimate than this. Didn’t Joseph take the most natural step when he made this request of the minister? Is man supposed to be passive and accept his fate without taking a step that might benefit him?The explanation of the midrash lies in the sages’ nickname for the Egyptian ministers, rehavim, meaning liars with no conscience. A subtle point is hidden here. There is no doubt that it was Joseph’s right, even obligation, to take care of himself in every way possible. But Joseph turned to a man who was not the natural one to help him, since the minister was a man interested only in himself and nothing else. The choice to ask someone like that was not done judiciously, but from a place of despair. And one must never act out of despair!The difference between a man who acts out of hope and a man who acts out of despair is tremendous. A man who acts out of hope measures his steps, carefully examines what he’s doing, and whether his actions will lead him to his goal – in this case, being released from prison. However, a man who acts out of despair will do anything, even things that are irrational and ineffectual, just for the possibility that it will increase the chances of reaching his goal.This is where Joseph failed in turning to the Egyptian minister. This was not a request made from hope, since it was made in vain. It was a request made from deep despair. This despair is destructive, and for this Joseph “paid” with two more years in the Egyptian prison.There is no question that it is our right and obligation to act in the best possible way to succeed. Man cannot remain passive and wait for success to come on its own. However, we must beware of actions that come from despair, such as reckless investments that promise “easy” profits or cost an unreasonable personal price. These actions that come from despair are a mistake, and will almost always reap no benefit.The writer is rabbi of the Western Wall and holy sites.