Oh how the champagne corks must have popped at Lambeth Palace, in July. The Church of England had secured yet another privilege for believers. The Archbishops' Council had all but exempted itself from new regulations on workplace discrimination, which the Government had introduced to conform with an EU directive.

This directive stated that, for the first time and after years of campaigning, employees were to be protected from discrimination on grounds of religion or belief, or sexuality. The gay community was pleased that, at last, a long–standing injustice was about to be eliminated.

But right from the framing of the directive in Brussels, religious groups were pressing for exemptions and special privileges. Recognising the dangers to the rights of non–believers, the National Secular Society (NSS) started its own campaign, even scoring an early success in the EU parliament which ensured that member states can only permit derogations passed by their own legislature, and no other country's.

Because the regulations were to be introduced by secondary legislation — which means only minimal debate in Parliament with no opportunity for amendments — the Government was obliged to undertake a long consultation process with interested groups.

We took a leading part at every stage in the national consultation process (even being asked how we thought it should be conducted). We had face–to–face meetings with relevant ministers and kept in close contact with officials, aiming to counter the intense pressure being exerted by religious groups to undermine the noble intentions of the regulations. The consultation turned out to be a farce.

When the version of the regulations to go before Parliament was published they contained a massive new religious exemption, almost word for word as had been demanded by the Church of England's Archbishops' Council. How had this happened?

There were all the signs of a night of the long knives. Although it was announced that the regulations had been published, even parliamentarians were unable to obtain them from the usual sources. Barbara Roche, the minister who had steered the regulations thus far, and who had seemed aware of the dangers of granting huge religious exemptions, was suddenly sacked just after the regulations were published.

The finger of suspicion points at Downing Street. There was a strong hint that Tony Blair himself had ordered the incorporation of the C of E's demands. A parliamentary scrutiny committee then publicly expressed fears that the religious exemptions might well go much further than the original directive permitted, rendering the legislation ultra vires. The Government was unmoved and pressed on.

In the House of Commons, an obscure committee examined the regulations. One of the NSS's honorary associates, Evan Harris, is a member of that committee, and we had worked with him closely over this. But despite his hard–hitting attacks on the legitimacy of the regulations, they were approved. In the House of Lords, veteran QC Lord Lester said of the flawed regulations: "the Government will face ultimate defeat and humiliation in the courts after costly and effective litigation."

All the same, they were approved, and will come into effect in December.

So what do the religious exemptions actually say? And what might the implications be for non–believers who happen to work for religious employers?

Discrimination on religious grounds is already permitted in publicly–funded religious schools through the Schools Standards and Framework Act 1998. This iniquity is to remain, and the regulations may even increase the discrimination permitted. Commercial employers, too, may be able to claim exemption if they can successfully argue that they have a 'religious ethos'. The Government has belligerently left the definition of 'religion' vague, and it will be up to the courts to decide whether a doctor's practice or a commercial garage has a 'religious ethos'.

With the Government's determination to introduce 'faith–based welfare', it is quite likely that the non–religious employees will find that their jobs have been handed over to religious groups who demand that all employees be of the faith. In such organisations every care assistant, doctor, nurse, cleaner, secretary and teacher may have to conform to the 'ethos'. Even services traditionally run by local authorities may be handed over to religious groups, and those employees who have no faith might find their jobs on the line. Employers with a 'religious ethos' will generally be permitted to favour a religious candidate, even if they are plainly not the best one for the job.

The most blatant of the religious exemptions, the one parachuted in by the Church, applies to "the employment … for purposes of an organised religion". Such an employer would be able to discriminate against a gay employee, or someone the employer reasonably thought to be gay (whether correctly or not), so as to comply with the "doctrines of the religion", or avoid "conflicting with the strongly held religious convictions of a significant number of the religion's followers." This wide–ranging let–out sub–clause contains no requirement for reasonableness or proportionality.

The religious sub–clause is even expected to allow a church to dismiss a long–serving employee who had no directly religious role — such as someone tending graves — if they were discovered to be homosexual. We are going to see some very unpleasant battles in courts and industrial tribunals as religious employers seek to favour their own.

We have lost an important battle, but we haven't given up. The next stage, however, will be a rear guard action.