Studying or Teaching in Mixed Schools
Question

I have a problem that is causing me to think a great deal and is making me frustrated. Approximately two months ago, I was able to do well in my exams to become a secondary school teacher, and now I am studying in a school that prepares teachers who specialise in English. I am studying in a mixed class composed of fifteen male students and fifteen female students. After that I will be appointed to teach in one of the secondary schools in my country. This secondary school is also mixed. What frustrates me in fact is that I know that mixing is forbidden, and that men are commanded to lower their gaze. But I tell myself that our country is not like other Muslim countries; moreover people who are religiously committed and righteous have to compete to attain these positions so as to bar the way to those who promote innovation and sin. Now I do not know whether I will be rewarded for what I am doing, or whether the Shaytan is making this action fair-seeming to me and making me think that I am keen to spread the Da`wah and benefit the Muslims by guiding them to correct belief and the sound path. I am convinced that it is not permissible for a non-Mahram man to teach women without a barrier, but isn’t my work necessary, because the secularists, Sufis and others are in control of most fields in our country?
Praise be to Allah.The prohibition of free mixing between men and women
One of the problems with which many Muslims are faced nowadays is the prevalence of free mixing in universities, hospitals , most public facilities and government workplaces. 
We have previously explained the prohibition on free mixing and the negative consequences that result from it, in the answer to question no. 1200 , where we stated that it is obligatory for the Muslim to avoid studying and working in mixed environments. 
Study or teaching in mixed schools
But in the countries where the people are faced with the problem of mixing in most fields of life , especially educational centres and workplaces , to the extent that it has become extremely difficult for the Muslim to protect himself from that, a concession is granted to them that is not granted to others whom Allah has protected from such problems. 
This concession is based on a principle of Fiqh (Islamic jurisprudence) that “whatever is prohibited so as to bar the means that may lead to evil may be permitted in cases of necessity and where doing so serves a greater interest.” 
Shaykh Al-Islam Ibn Taymiyyah (may Allah have mercy on him) said: 
“All Islamic rulings are based on the principle that some evil which is ordinarily prohibited becomes permissible if there is an urgent need that outweighs." (Majmu` Al-Fatawa 29/49) 
He (may Allah have mercy on him) also said: 
“With regard to that which comes under the heading of barring the means (that lead to something prohibited), it is only to be prohibited if there is no need for it. However, if there is a need for it in order to achieve a purpose that cannot be achieved otherwise, then it is not to be prohibited." (Majmu` Al-Fatawa  23/214) 
Ibn Al-Qayyim (may Allah have mercy on him) said:
“That which is prohibited so as to bar the means (that lead to something prohibited) may be permitted if there is a clear benefit to be achieved, for example: … Nafl prayers that are offered for a specific reason are permissible after Fajr and ‘Asr (when Nafl prayers that are not done for a specific reason are not allowed, until after sunrise and sunset respectively); it is permissible for one who wants to propose for marriage, one who is giving a testimony, a doctor and one who is party to a transaction, buying or selling, to look at a woman’s face in a manner that is ordinarily prohibited; and the prohibition on gold and silk for men is a prohibition that serves to bar the means that may lead to men imitating women, for which the one who does that is cursed, but it is permitted in cases of necessity." (I`lam Al-Muwaqqi`in  2/161) 
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said:
“With regard to that which is prohibited in the sense of prohibiting the means (that may lead to something prohibited), it may be permitted in the case of necessity." (Manthumat Usul Al-Fiqh  p. 67) 
What appears to be the case, and Allah knows best, is that in such countries where this problem (free mixing) is widespread, a concession may be granted allowing the people to study and work in mixed environments, such as is not granted to others, as stated above. 
Conditions of studying or working in mixed schools
Nonetheless, the following are some conditions that have be met: 

One should first of all strive hard to look for a place in which there is no mixing, as much as possible. 


One should adhere to the Islamic rulings such as lowering the gaze, and not talking and engaging in conversation more than is necessary for the purpose of work or study. 

Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked about a young man who cannot find anything but a school that is mixed. He said: 
“You have to look for a school that is not like this, but if you cannot find such a school, and you need to study, then you may read and study, and try to the best of your ability to keep away from immorality and temptation, by lowering your gaze, guarding your tongue, not talking to women and not walking past them." (Fatawa Nur `Ala Ad-Darb  1/103, 13/127) 

If one notices in himself an inclination towards that which is prohibited, and realises that he is being tempted by some of the women who are with him, then preserving his religious commitment takes precedence over all other benefits. In that case, it becomes essential for him to leave that place, and Allah, may He be Glorified and Exalted, will make him independent of means by His bounty. 

And Allah knows best.