In order for the marriage to be valid, it is stipulated that it should be done by the wali (guardian) or his deputy, because the Prophet (blessings and peace of Allah be upon him) said: “There is no marriage except with a guardian and two witnesses of good character.” Narrated by al-Bayhaqi from the hadeeth of ‘Imraan and ‘Aa’ishah. Classed as saheeh by al-Albaani in Saheeh al-Jaami‘, no. 7557
And the Prophet (blessings and peace of Allah be upon him) said: “Any woman who gets married without the permission of her guardian, her marriage is invalid, her marriage is invalid, her marriage is invalid.” Narrated by Ahmad, 24417; Abu Dawood, 2083; al-Tirmidhi, 1102. classed as saheeh by al-Albaani in Saheeh al-Jaami‘, no. 2709
At-Tirmidhi (may Allah have mercy on him) said: In this regard, what is to be acted upon is the hadeeth of the Prophet (blessings and peace of Allah be upon him), “There is no marriage except with a guardian,” according to the scholars among the Companions of the Prophet (blessings and peace of Allah be upon him), including ‘Umar ibn al-Khattaab, ‘Ali ibn Abi Taalib, ‘Abdullah ibn ‘Abbaas, Abu Hurayrah and others. End quote.
The woman’s guardian is her father, that his father (her paternal grandfather), then her son, then his son (this applies if she has a son), then her brother through her father and mother, then her brother through her father only, then her brother’s sons (her nephews), then her paternal uncles, then their sons, then the ruler.
Thus it is known that the mother’s husband is not a guardian for the girl, and her brothers through her mother are not her guardians either, according to the well-known view, because guardianship belongs only to male relatives on the father’s side.
Ibn Qudaamah (may Allah have mercy on him) said in al-Mughni, 7/13: There is no guardianship for relatives other than male relatives on the father’s side, (so the following cannot be a woman’s guardians): the brother through the mother, the maternal uncle, the mother’s paternal uncle, the maternal grandfather, and so on. This was stated by Ahmad in several places. It is also the view of ash-Shaafa‘i and one of two views narrated from Abu Haneefah.
The second view is that anyone who may inherit an allocated share or through ta‘seeb (by virtue of being a male relatives on the father’s side) may act as a guardian, because he is one of those who may inherit from her; therefore those who may inherit an allocated share may also act as guardians, just as male relatives on the father’s side may act as guardians.
The brother through the mother may inherit an allocated share, and there is a difference of scholarly opinion as to whether he may act as a guardian in the case of marriage, as you can see.
The basic principle is that if a woman does not have a guardian, then the Muslim qaadi (judge) may act as her guardian and arrange her marriage; if there is no Muslim judge then the imam of a mosque or a scholar or a Muslim man of good character may act as her guardian and arrange her marriage.
There is no doubt that her brothers through her mother have more right to acts as guardians and arrange her marriage than the imam of the mosque or any other Muslim, so her brother through her mother should do the marriage contract for her after getting her permission and consent.
In al-Mawsoo‘ah al-Fiqhiyyah (41/277) it quotes the Maalikis as saying: If a woman has no male relative on her father’s side or former master or sponsor, and there is no shar‘i judge, then her marriage contract may be done by a Muslim man, such as her maternal uncle, maternal grandfather or brother through the mother. They are among the people who may act as her guardian with her permission and consent in that case. End quote.
And Allah knows best.