Praise be to Allah.
In order for a marriage to be valid it is stipulated that it be done by the woman’s guardian or his proxy, because the Prophet (blessings and peace of Allah be upon him) said: “There can be no marriage contract except with a guardian.” Narrated by Abu Dawood (2085), at-Tirmidhi (1101) and Ibn Maajah (1881) from the hadith of Abu Moosa al-Ash‘ari; classed as saheeh by al-Albaani in Saheeh at-Tirmidhi.
The woman’s guardian is her father, then his father (her grandfather), then her son, then his son (her grandson – if she has a son), then her full brother, then her brother through her father only, then her brothers’ sons, then paternal uncles, then their sons, then the father’s paternal uncles, then the ruler. See: al-Mughni (9/355).
This is the view of the majority of fuqaha’, except the Hanafis who regard it as permissible for a woman to arrange her own marriage without a guardian.
If a woman gets married without a guardian, or the imam of the mosque does her marriage contract even though she has a guardian, then there is a difference of opinion among the fuqaha’ concerning such a marriage. If it happens, it is not to be annulled, in light of the difference of scholarly opinion concerning that.
In many Muslim countries – including your country, Pakistan – the shar‘i judicial system is based on the madhhab of Imam Abu Haneefah (may Allah have mercy on him), in which a woman’s marriage without a guardian is regarded as valid.
See the answer to question no. 173946
If the one who proposes marriage to you is compatible with you in terms of religious commitment and character, and you accept him, then your guardian does not have the right to refuse to give you in marriage to him, and if he refuses then he is to be regarded as wilfully preventing your marriage (for no valid reason), and guardianship passes to the next in line (among the relatives mentioned above). If all of them refuse, then your marriage may be arranged by the Islamic qaadi (judge) or one who is acting in his stead, such as the person in charge of an Islamic centre.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If the guardian refuses to arrange the marriage of a woman to a suitor who is good in terms of religious commitment and character, then guardianship passes to the next in line of male relatives on the father’s side, the closest then the next closest. If they refuse to arrange the marriage, as often happens, then guardianship passes to the Islamic judge, and the Islamic judge may do the marriage contract for the woman. If the case reaches him and he knows that her guardians have refused to arrange her marriage, then he must do her marriage contract, because he is in a position of general guardianship, so long as the specific guardianship has not been carried out properly.
End quote from Fataawa Islamiyyah (3/148).
Shaykh Ibn Baaz (may Allah have mercy on him) said:
What the guardian must do is fear Allah and not wilfully prevent the woman’s marriage (for no valid reason); he should try hard to make marriage easy for her. If a good and compatible suitor proposes to her, the guardian must be easy-going with regard to the matter and should try hard to protect the chastity of the woman under his guardianship and make it easy for her to get married, and he should not be stubborn or make unreasonable demands with regard to the mahr or the wedding feast and so on.
This is what he must do, and if he prevents her from getting married or makes unreasonable demands in these matters, then she may refer the matter to the court, if there is an Islamic court in her country, so that the court may examine the case, and rebuke the guardian. But if the woman is living in a country where she has no guardian, brother, father, or cousin, then the ruler takes the place of the guardian, and her guardian is the ruler, because the Prophet (blessings and peace of Allah be upon him) said: “The ruler is the guardian of the one who has no guardian.” So the ruler takes the place of her guardian and becomes her guardian, and he may arrange her marriage or appoint someone to do so.
But if she is living in a country where there is no Muslim ruler or Muslim judge or guardian, as in the case of Muslim minorities in the lands of the disbelievers, then the head of the Islamic centre may arrange a marriage, if they have an Islamic centre, because he is like the ruler in their case. The head of the Islamic centre should examine her situation and arrange her marriage to a good and compatible man, if she has no guardians and there is no Islamic judge (qaadi).
If her guardian is far away, then he may be requested to appoint a proxy.
If his whereabouts are not known, then the next closest guardian may take his place; the one who is next in line to him may take his place.
If she has no guardian except the one who is absent and whose whereabouts are unknown, then the ruler may take his place.
End quote from Fataawa Noor ‘ala ad-Darb by Shaykh Ibn Baaz (20/200)
Based on that, if your guardians all refused to arrange a marriage, and the imam of the local mosque arranged your marriage and did your marriage contract, then the marriage is valid, as mentioned above.
If the proposal and acceptance were done in the presence of two witnesses, the marriage is valid, even if it was not written down on the appropriate form or was not recorded officially.
But documentation is essential nowadays, because dishonesty is becoming widespread and because people tamper with the rights of others, as has been explained previously in the answer to question no. 129851.
Therefore you must hasten to document this marriage officially.
And Allah knows best.