Praise be to Allaah.
It is permissible for a woman to ask for divorce (talaaq) if the husband persists in committing immoral actions, such as drinking alcohol or taking drugs. If the husband refuses to give her a divorce, she may refer the matter to the Islamic judge (qaadi) so that he can force the husband to divorce her or he himself can issue a divorce, if the husband refuses to give a divorce. If there is no Islamic judge, she may refer the case to the Islamic authorities in her country, such as the Islamic Centre, so that they can convince the husband to issue a divorce (talaaq) or ask him to let her go by means of khula‘. And it is permissible to have that shar‘i divorce (talaaq) documented after that in the court that is based on the man-made law of the land, because there is a need for that documentation.
If you went to the court that is based on the man-made law of the land and the court obliged your husband to issue a divorce, and he spoke the word of divorce (talaaq) or he wrote it down with the intention of divorce, then it counts as such.
If he did not utter or write the word of divorce (talaaq) with the intention of divorce, and it was the court that issued a ruling of divorce, then a divorce ordered by a kaafir judge does not count as such.
The fuqaha’ are unanimously agreed that being Muslim is an essential condition of the judge who judges cases among the Muslims, because serving as a judge is a kind of wilaayah (authority), and there is no wilaayah for a kaafir over a Muslim.
Ibn Farhoon (may Allah have mercy on him) said: al-Qaadi ‘Ayyaad (may Allah have mercy on him) said: The conditions of serving as a judge, without which the judgement cannot be valid and without which the appointment of the judge cannot be valid, are ten: being a Muslim; being of sound mind; being male; being free (not a slave); being an adult; being of good character; having knowledge; being one person (i.e., you cannot have two judges at the same time); not being blind or deaf; and not being mute or nonverbal. The first seven are essential for the appointment of the judge to be valid, and the last three are not essential to it being valid, but if they are not met it means that the judge should be dismissed. And judgeship of a kaafir is not valid, according to consensus, and neither is that of one who is insane.
End quote from Tabsirat al-Hukkaam, 1/26. See also al-Mawsoo‘ah al-Fiqhiyyah, 33/295
The final statement of the second conference of the Fiqh Council of North America, which was held in Copenhagen, Denmark, with the Muslim World League, 4-7 Jumaada al-Oola 1425 AH/22-25 June 2004 CE, stated that: a concession is granted allowing one to refer to the court that is based on the man-made law of the land, when doing so becomes a means of getting one’s rights or warding off wrongdoing in a land that is not ruled by sharee‘ah, on condition that those who have knowledge of sharee‘ah be consulted to determine the shar‘i ruling that is applicable to a given case, and that the demand be limited only to seeking what sharee‘ah allows and trying to implement it.
It also says:
Seventh clause: the extent to which civil divorce done in lands outside the Muslim world is valid:
The statement explains that if a man divorces his wife in a shar‘i manner (talaaq), there is nothing wrong with documenting it in the court that is based on the man-made law of the land. But if there is a dispute between the spouses about the divorce and connected issues, the Islamic centres may play the role of the Muslim judge (qaadi) where there is none, after doing all legally required procedures. Referring to the man-made judicial system to end the marriage does not on its own dictate the end of the marriage from the shar‘i point of view. If the woman gets a civil divorce, then she may go to the Islamic centre and refer the matter to people who are qualified to deal with these matters and have sufficient knowledge, to complete the matter from the shar‘i point of view. One cannot make the excuse that this is a matter of necessity because Islamic centres are available and easy to refer to in various regions. End quote.
Based on that, you have to refer to the Islamic centre in your city, and they can take care of the matter.
If a woman has been divorced by her husband with a first or second talaaq, and the ‘iddah has ended, it is permissible for him to marry her again with a new marriage contract and a new mahr, in the presence of her wali and witnesses.
But if it was the third talaaq, she is not permissible for her first husband until she has been married to someone else, in a genuine marriage, not a tahleel marriage (one which is aimed at making it permissible for her to go back to her first husband), then the second husband dies or divorces her.
And Allah knows best.