In the past few years I was committing a very sinful act (masturbation) and I want to get out of this darkness. Can you tell me what I should do to get rid of this act and to build up my faith and patience.

Please read below.

MASTURBATION …THE PERPETRATOR AND THE VICTIM
In order that we do not digress from the topic, the main matter that needs explanation in the light of the Shariah and the Islamic instructions is masturbation.
Masturbation is forbidden, since Islam wants that sexual matters to be satisfied through spousal relations only. This is different from the negative situations where sexual relations occur purely as, a physical joining of the bodies bereft of any supporting spiritual relations. This is in addition to the negative impact on the psychological aspect as well as life as a whole.
Thus, masturbation is forbidden in every way, shape, or form including the sexual imagination that leads to orgasm. But although this act is prohibited, we must understand the normal, natural circumstances that push pubescent boys and girls to indulge in this bad habit. For the call of impulse and passion, and the resorting to this practice as a habit intended to satisfy these impulses, make masturbation one of the easiest habits to acquire, especially under social pressures which prevent any interaction between man and woman outside the limits of permanent marriage. Another influencing factor is the economic pressure preventing the youth from early marriage; or the aspect of traditions which prevents the girl from preparing for an early marriage , and similar factors placed by social restrictions.
EARLY MARRIAGE
Islam has welcomed early marriage, since marriage as a natural state that is far detached from the pitfalls which others have placed in its path, in terms of mental and social maturity, financial means… etc. Islam sees one of the benefits of marriage is to provide a means of satisfying the sexual appetite of man and woman. It recognizes that other issues may develop and grow with this bond, which may be nurtured in exactly the same way as in other relations.
As for the problem of pregnancy and child rearing, adequate solutions are possible, on the realization that we live the problem outside of early marriage and inside it. Islam, however, emphasizes early marriage for youths, regards the dowry (mahr) as a mere formality and focuses on making marriage easy in respect of the economic or financial requirements imposed by the community.
When we understand the general Islamic outlook, we can see that it is possible for students to marry and pursue their studies, to live in their parental homes or a single room which they rent while at university. They can live their life with the same ease that they live their life as students.
We notice that social traditions that place economic and societal restrictions or iron curtains on marriage to the point where marriage is not embarked on until one is in his thirties or later, while early marriage with all its problems is a basic solution in Islam to several problems.
TEMPORARY MARRIAGE AND SEX INFERIORITY COMPLEX
From the Shiite point of view, there is another solution, and that is "temporary marriage", or the "breakable contract", which may have certain reservations on it, specifically in relation to virgins. With respect to widows and divorcees, however, there is no difficulty.
Islam does not regard the issue of sexual relations between the two genders for the purpose of satisfying the sexual appetite as a reprehensible contract, or that it assails the honor of a woman, for Islam regards sex as a natural need, in exactly the same way it does food and drink. When the human being wants to sate this carnal hunger by going to another human being it does not impugn the honor of that person. But, when we see sex only in light of the pitfalls which an air of excessive restriction create, then we go very far from the naturalness of sex.
Sex is a natural condition, indeed, and it is possible for a woman to seek the satisfaction of her impulses, in a natural manner, with a man with whom she reaches an agreement with in all candor. So, too, it is possible for a man to do this with candor, without any party hurting the other, since it is a practice allowed by God. If they cannot enter into permanent marriage, they will instead enter a temporary one according to Shariah guidelines, under certain social controls, and when society reaches a level where it is convinced of the validity of this marriage.
We may face the issue of the children born unexpectedly, in view of the fact that they are legitimate children. The problem stems from the fact that society may bar its youths every opportunity by which they can sate their hunger, and which drives them to masturbation, whether it realizes it or not.
SEX EDUCATION AND SOCIAL VALUES
In view of the harsh social values, how can a proper understanding of sex that is devoid of distortions and misconceptions be reached?
A proper understanding can only come about when the persistent social view of sex is changed, and the idea that it is something dirty or an affront to the dignity of the woman is abandoned. A social revolution must change the general views on marriage in such a way as to make us see that this institution provides the means to establish a simple and natural bond, without inviting the social pitfalls which we had inherited from non Islamic cultures. This is because Islam considers that marriage is essential between man and woman.
The crux of the matter is that the marriage contract does not need religious authority, nor does it require any societal convention to fall within the scope of the Shariah. With the requisite Shariah conditions regarding the man and the woman, it is sufficient for the woman to say to the man: "I marry myself to you, with the dowry (mahr) value of so and so"; and that he says to her, "I accept this marriage according to the agreed mahr or the agreed conditions." With this, they are regarded before God (Exalted) as man and wife.
In the Imami Shiite school of Jurisprudence, we notice that it is not stipulated that there should be two witnesses in marriage, but that it is commendable; since people may need to be married in circumstances where there are no witnesses. Recording the marriage in an official or Shariah registrar is exactly like registering any other contract or agreement it may be deemed legally established, but has no impact on the marriage itself from the Shariah point of view. The Shariah status of the bond is by virtue of the agreement between the two people as something specific between them, exactly as in the case of a business transaction, incorporation… etc.
The solution to the sex problem, free of deviancy, obliges us to facilitate the matter of marriage and to abandon this pile of bugbears the product of a social tradition which has made marriage a difficult hurdle in the life of our youth. Because of this, our girls have been driven to deviation through its widest doors.
WHAT IS THE VIEW OF ISLAM ON LOVE?
What is the view of Islam on love between the two sexes, between boy and girl; is it something allowed by the Shariah, especially if we know that it can occur sometimes in a involuntary manner?
Islam wants all of humankind, male and female, to experience human love, which allows people to feel for one another, and thus makes them feel united within the sphere of humanity. This love leads to nurturing, guarding, protecting, taking care of needs, preserving honor, respecting women, and so forth. Thus, we see the Messenger of God (p.) associating faith with love, for he said: "None of you is a true believer until he loves for his brother what he loves for himself, and hates for his brother what he hates for himself." This makes us understand that according to this hadith Islam emphasizes the issue of love which makes you sympathize with the feelings of the other.
Consequently, you are not a true believer if your view regarding others is one of emptiness, unconcern, without any feelings for their affairs. Hence, we find that the well known hadith stipulates this: "Who does not concern himself with the affairs of the Muslims is not a Muslim."
The issue is that a human must love others who he shares their humanness. According to a hadith, when some people asked him about love, Imam Jafar al Sadiq (a.s) replied, "And is religion anything but love?" This then is the issue, in its separation from humanness.
But there is also the aspect of human impulse which causes a person to love another in the same way that he loves his food and drink. His love is sexually directed towards a certain person. This is what most youths experience at the stage of adolescence and thereafter an attraction for physical beauty, sexual activity, and so forth. We notice that Islam wants humankind (male and female) to experience this love in a manner that culminates in marriage. There is no objection against a man loving a woman, admiring her beauty, and wanting to marry her. Islam allows a man to look at a woman whom he wants to marry in order to reflect on his attraction and desire for her from one perspective or another.
However, love which a person takes as fun, an infatuation, or where sex is not limited to the legal boundaries of marriage, is rejected by Islam. In fact, everything that leads to sexual aberration, regardless of whether it is from the heart, the eyes, the tongue, the hands or other organs, and everything that leads to the sexual act, regardless of whether it is petting or practice, is repudiated by Islam, for it leads to moral problems, wherein a person distances himself from the proper path prescribed by God.
When we speak of love as a involuntary psychological state, then we cannot dictate any law regarding this emotion. For God does not hold a person liable for that which he is incapable of, or anything beyond reason. However, Islam wants emotions to be kept under control, and therefore pushes the person, carefully and intelligently focusing his emotions, to think deeply, rather than dealing only with the surface. Islam tries to inculcate in its youth the ability to prevent them from acting solely after first impressions, or on the basis of skin deep ideas. Islam did not propound this solely for spousal relations, but for every human relation, such as friendship, etc.
From another perspective, Islam has put controls on this love and does not push the two parties to remain alone in private; it does not permit them to express their love through petting or other forms which lead to the influence of impulses indicated earlier. On the other hand, Islam does not prohibit innocent talk, which expresses the emotion in a way that accords with a Shariah based relationship.
INSTINCTIVE LOVE AND PLATONIC LOVE
Is it possible for us, with respect to love, to speak of what is termed "Platonic love" or virtuous, sentimental love?
When you speak of love as an emotion, you cannot categorize it as "Platonic", on the one hand, and "instinctive", on the other. But we may say that there is a state of sexual desire which some people may term "love" i.e., a state where there is a physical attraction between one body and another body, not a state where one person loves another person. The issue of physical attraction represents a physical act where one body gets close to another without there being any place for the facet of humanness in it.
But love is a human emotion which attracts you to another person by way of the beautiful, ideal, functional, or other attributes. We bear the responsibility to differentiate between the emotion which plays a role in physical contact, and that which plays a role in the appreciation of a person, in a natural relationship structured on the basis of mutual respect.