This situation recently arose at my work. Eight of us worked in the same department, doing the same things. Two of us were temporary. The company wanted to cut the whole department down. So, perversely, us two temporaries were made permanent, then the day after that they asked for redundancies.
The management said this was because they couldn't make permanent staff redundant while there were temporary staff doing the same job.
And, obviously as it turned out, they wanted to keep us two temps, and get rid of some of the permies.