Using an ultrashort laser pulse, we explore ab initio the spin dynamics of Gdx(FeCo)1−𝑥 at femtosecond time scales. Optical excitations are found to drive charges from Fe majority d-states to unoccupied Gd f-minority states with f-electron character excited occupation lagging behind that of the d-electron character, leading to substantial demagnetization of both species while leaving the global moment almost unchanged. For x > 0.33, this results in the creation of an ultrafast ferromagnetic (FM) transient by the end of the laser pulse with the Gd demagnetization rate slower than that of Fe. For all concentrations, the Gd moments begin to rotate from their ground state orientations developing in-plane moments of between 0.2 and 0.5 μB. Thus, the ultrafast spin dynamics of the material captures three important ingredients of all optical switching that occurs at much later (picosecond) times: (i) the development of a FM transient, (ii) the different rates of demagnetization of Fe and Gd, and (iii) the breaking of the collinear symmetry of the ground state. Furthermore, several predictions are made about the behavior of Fe–Gd alloys that can be experimentally tested and can lead to a spin-filtering device.