The marriage should be religiously valid. This is because the religious validity of an act depends on Allah's law and not the laws made by people. This is similar to how, for example, a divorce effected by a non-Muslim court is not religiously valid (islamqa,2).
According to Islam, age is not a factor in the validity of a marriage - with certain exceptions such as the marriage of orphans or marriage that is done without the permission of their guardians. Even then what makes one a minor or adult is puberty and not necessarily a numerical age. A 14 years old girl could be considered an adult in Islam if she has reached puberty.
Marriage of minors is permissible and valid, with some conditions. Among the evidence of which is the Quranic verse:
واللائي يئسن من المحيض من نسائكم إن ارتبتم فعدتهن ثلاثة أشهر واللائي لم يحضن
And those who no longer expect menstruation among your women - if you doubt, then their period is three months, and [also for] those who have not menstruated.
— Quran 65:4
As this verse talks about iddah of a girl who does not menstruate, and this includes one who does not menstruate because of being too young. Iddah is only applicable after marriage, so it implies that marriage of such a girl is permissible.
وأنكحوا الأيامى منكم
And marry the unmarried among you
— Quran 24:32
As this verse is addressed to guardians and tells them to marry off those who are unmarried among their dependents. Both minors and adults are included in the literal meaning of أيامى (unmarried ones).
وأحل لكم ما وراء ذلكم
And lawful to you are [all others] beyond these
— Quran 4:24
As this verse permits marriage to all women except the mahrams mentioned beforehand in its context. Since minors are not mentioned in the list of mahrams it can be deduced that marriage to them is permitted.
From the Sunnah we also have evidence for this, such as the marriage of Aisha to the Prophet ﷺ. And there are also examples of such marriages among the sahaba such as the marriage of Umar ibn al-Khatab to Umm Kulthum or the marriage of Qudama bin Maz'un to the daughter of Zubayr .
Further its permissibility is largely agreed upon:
وأجمعوا أن نكاح الأب ابنه الصغير جائز
There is consensus that it is valid for a father to marry off his minor daughter
— Al-Ijma' - Ibn Mundhir
Regarding how this mess may be sorted out:
- The husband may divorce the girl if he wishes.
- The couple may emigrate back to their native lands if the marriage is acceptable there.
- The couple might wait for the bride to reach the required age before resuming their relationship