Until now, RE teachers, whether they taught in private or state schools, were at the mercy of their local bishopric, which had the right to hire them and terminate their contracts, even though they were employed and paid by the government. In recent years scores of appeals have been heard in courts around the country brought by teachers complaining of unfair dismissal that had nothing to do with how they did their jobs.
One teacher lost his job for getting married in a civil ceremony, another for not attending mass regularly. A third was sacked for participating in a perfectly legal strike against the school, along with his colleagues.
Scores of similar cases are awaiting hearings, including five in the European Court of Human Rights in Strasbourg.
RE teachers will now fall under the protection of the workers' statute.
They will be hired according to "objective criteria of equality and merit"
and their contracts will be automatically renewed at the end of every year without the church being able to dismiss them if it sees fit. In effect, they will no longer be employed by the church, but by the state.
Luis Guridi, the vice-president of FEPER, the union representing RE teachers, said: "With this new law the constant stress and instability about the ever-possible and arbitrary loss of their livelihood will no longer be the lot of the RE teacher."
The new law is the latest in a series of moves by Jose Luis Zapatero's socialist government to reduce the power of the church in state education in Spain. Last month the socialists overturned a law making religious education compulsory.