My institution has a policy whereby anybody in the last three months of contract must be seen for interview for a marked redeployee post or given contructive feedback as to why they were passed over.

I applied for such a post on the 13th July (closing date 14th July) and reciept of my application was acknowledged the same day.
I was told eventually that I had not been selected for interview.
Finally today I approached them for feedback -apparently my application was of very high quality but somebody applied on the 11th and was given the job.

Is this legal?

I fulfilled the job specification to the letter, and was under the impression that applying in time would give me an equal chance of being considered.
I’ve also suffered from a good deal of stress, labouring under the impression that there was something inherently wrong with my CV, and feel somewhat aggrieved.

All advice appreciated.