I had had pains when I was pregnant 5 months. So I had dead twins. I comply with everything coming from God. I sometimes sorrow and cry. How much is it permissible to cry and sorrow over the deceased by Islam?
The event which you had come to deal with is a consequence of God’s rule to test people. He tests people in the worldly life. Allah commands:
“We will surely test you through some fear and hunger, by means of diminishing your possessions, lives and yields. Give glad tidings to those who are patient. When such an incident befalls them, they say: “We belong to God and we will certainly return to His presence.” They are the ones who have the constant support and grace of their Master. They are the ones who are on the right path.” (Al-Baqarah/The Bull 2:155-157)
It has been narrated from Nabi Muhammad (pbuh):
“Strange are the ways of a believer for there is good in every affair of his and this is not the case with anyone else except in the case of a believer for if he has an occasion to feel delight, he thanks (God), thus there is a good for him in it, and if he gets into trouble and shows resignation (and endures it patiently), there is a good for him in it.” ( Reference: Sahih Muslim 2999, In-book reference : Book 55, Hadith 82, USC-MSA web (English) reference : Book 42, Hadith 7138)
Crying over such events is not prohibited provided that you do not revolt against Allah and you surrender to His orders. Indeed it has been narrated about Prophet Muhammad (pbuh) that he had cried for death of his children and grandchildren.
“Narrated Anas bin Malik: We went with Allah’s Apostle (p.b.u.h) to the blacksmith Abu Saif, and he was the husband of the wet-nurse of Ibrahim (the son of the Prophet). Allah’s Apostle took Ibrahim and kissed him and smelled him and later we entered Abu Saif’s house and at that time Ibrahim was in his last breaths, and the eyes of Allah’s Apostle (p.b.u.h) started shedding tears. ‘Abdur Rahman bin ‘Auf said, “O Allah’s Apostle, even you are weeping!” He said, “O Ibn ‘Auf, this is mercy.” Then he wept more and said, “The eyes are shedding tears and the heart is grieved, and we will not say except what pleases our Lord, O Ibrahim ! Indeed we are grieved by your separation.”” (Bukhari, Funerals, 43; Muslim, Virtues, 62; Abu Dawood, Funerals, 23-24; Ibn Majah, Funerals, 53)
“Narrated Anas bin Malik: We were (in the funeral procession) of one of the daughters of the Prophet and he was sitting by the side of the grave. I saw his eyes shedding tears” (Funerals of Sahih Bukhari)
“Narrated Usama bin Zaid: The daughter of the Prophet (p.b.u.h) sent (a messenger) to the Prophet requesting him to come as her child was dying (or was gasping), but the Prophet returned the messenger and told him to convey his greeting to her and say: “Whatever Allah takes is for Him and whatever He gives, is for Him, and everything with Him has a limited fixed term (in this world) and so she should be patient and hope for Allah’s reward.” She again sent for him, swearing that he should come. The Prophet got up, and so did Sad bin ‘Ubada, Muadh bin Jabal, Ubai bin Ka’b, Zaid bin Thabit and some other men. The child was brought to Allah’s Apostle while his breath was disturbed in his chest (the sub-narrator thinks that Usama added: ) as if it was a leather water-skin. On that the eyes of the Prophet (p.b.u.h) started shedding tears. Sad said, “O Allah’s Apostle! What is this?” He replied, “It is mercy which Allah has lodged in the hearts of His slaves, and Allah is merciful only to those of His slaves who are merciful (to others).” (Bukhari, Funerals 32,43, Marza, 9, Ayman, 9, Tawhid, 2; Muslim, Funerals, 11; Abu Dawood, Funerals, 23-24; Nasai, Funerals, 13, 22; Ibn Majah, Funerals 53; Ahmed b. Hanbal 1/268, 273)