GCHQ has advertised a job in its IT department but said only people 'from an ethnic minority background or women' should register an interest.
The intelligence agency's post on its own website states that 'diversity and inclusion are critical to our mission' and that it welcomes applications from 'everyone' - before suggesting that white men are excluded from registering their interest in the role.
The move was labelled 'completely unacceptable' by Philip Davies, MP for Shipley in West Yorkshire, who branded the agency 'morons'.
GCHQ later edited the advertisement after being contacted by MailOnline to add that 'applications from candidates of all ethnicities and genders will be welcome' once the registering of interest period ends in seven weeks' time.
It is against the law 'to treat someone less favourably than someone else because of a personal characteristic such as religion, sex, gender reassignment or age,' the Government website states.
GCHQ (pictured) explicitly stated only people 'from an ethnic minority background or women from any ethnic background' should register interest in the role in a move slammed by an MP as 'completely unacceptable'
Confusingly, GCHQ's posting went on to claim applications were welcome 'from everyone'. A note warning registration of interest was only open to 'those from an ethnic minority background and women' was highlighted in bold twice - at the start and end of the posting
The GCHQ post read: 'At GCHQ, diversity and inclusion are critical to our mission. To protect the UK, we need a truly diverse workforce that reflects the society we serve.
'This includes diversity in every sense of the word: those with different backgrounds, ethnicities, gender identities, sexual orientations, ways of thinking and those with disabilities or neurodiverse conditions.
'We therefore welcome and encourage applications from everyone, including those from groups that are under-represented in our workforce.'
Despite boasting about being champions of Stonewall diversity and black history month, the employer appears to have excluded white men from registering interest in the role
A note warning registration of interest was only open to 'those from an ethnic minority background and women' was highlighted in bold twice - at the start and end of the posting.
That note has seen been amended to read: 'Please note this Registration of Interest is only open to those from an ethnic minority background or women from any ethnic background.
Government's guidance on avoiding discrimination in job postings
You must not state or imply in a job advert that you’ll discriminate against anyone. This includes saying that you are not able to cater for workers with a disability.
Only use phrases like ‘recent graduate’ or ‘highly experienced’ when these are actual requirements of the job.
Otherwise you could discriminate against younger or older people who might not have had the opportunity to get qualifications.
Where you advertise might cause indirect discrimination - for example, advertising only in men’s magazines.
Employing people with protected characteristics
You can choose a candidate who has a protected characteristic over one who does not if they’re both suitable for the job and you think that people with that characteristic:
You can only do this if you’re trying to address the under-representation or disadvantage for that particular characteristic. You must make decisions on a case by case basis and not because of a certain policy.
You cannot choose a candidate who is not as suitable for the job just because they have a protected characteristic.
'Following a Registration of Interest period of several weeks, we will open this role for applications. At this stage, applications from candidates of all ethnicities and genders will be welcome.'
Mr Davies MP slammed the decision as he called GCHQ's recruitment department 'morons'.
He told MailOnline: 'It is completely unacceptable. It is disgraceful to be perfectly honest. Why they think they should be able to discriminate on grounds of race and sex is beyond me.'
He said white working class boys were 'the one category with the worst outcomes in the UK' and preferential treatment shouldn't be given to a black old Etonian or a public schoolgirl.
He added: 'Most people would think it is disgusting for employers to say they will filter people out of jobs on the basis of race. It is completely and utterly unacceptable.
'It should be illegal and everybody, apart from obviously the morons at GCHQ, knows white working class boys are the one category with the worst outcomes in the UK.
'Are they really saying they want to give preferential treatment to a black old Etonian or a female public schoolgirl over a white working class boy? What possible justification could they have.
'I advise they go back to the drawing board and I hope they treat the security of our county with a less cavalier approach than they do their recruitment policy.'
Employers should not discriminate against anyone while advertising a job vacancy, according to the Government's website.
It reads: 'You must not state or imply in a job advert that you’ll discriminate against anyone. This includes saying that you are not able to cater for workers with a disability.'
And although preference can be given to someone with a 'protected characteristic', this must be on a case-by-case basis and 'not because of a certain policy'.
GCHQ told MailOnline: 'Diversity and inclusion are mission critical for GCHQ, ensuring we're more representative of the communities we serve to better protect the UK.
'This registration of interest is one of a number of steps we're taking to encourage more women and people from ethnic minority backgrounds to consider careers.
'When the job advert for this role does go live anyone will be able to apply for it.'
It comes after a senior civil servant accused the Government of seeking to avoid 'reputational damage' by paying a black female colleague £52,000 more than him.
Matthew Parr is suing the Home Office for sex and race discrimination after discovering he was earning less than his counterpart for doing the same job.
He claimed being a white man meant he was paid a £133,983 salary, plus £7,904 living allowance, while Wendy Williams took home £185,000.
Both are one of five HM Inspectors of Constabulary (HMIs) who act as watchdogs for the UK's police forces.
Matthew Parr is suing the Home Office for sex and race discrimination after discovering he was earning less than his counterpart Wendy Williams (right) for doing the same job
Mr Parr, a former rear admiral, was appointed in 2016 during Theresa May's tenure as Home Secretary when Whitehall was driving down the salaries of top officials.
An employment tribunal heard that at the time of Ms Williams' appointment 15 months earlier, the Treasury was also trying to reduce pay packets.
But it heard that mandarins agreed she would be paid the top £185,000 salary as awarding her less than existing HMIs could open the Government up to a discrimination challenge.
Mr Parr said in a witness statement: 'Documents disclosed by the Respondent make clear that Wendy Williams was paid the top of the band then in force, because of concern that to pay her less than her fellow HMIs presented the Government with a risk of legal challenge on the grounds of discrimination and of reputational damage.'
He claimed his 'race and sex had a clear influence' on the decision to pay him the substantially less £133,983 when he came into post.
The Government denied sex and race discrimination and maintained plans to lower salaries were always going to come into force regardless of the person who took the position.