Question about nekro flagship ability

So, imagine the following scenario. As a nekro player, I got my flagship, a carrier, and 7 infantries in a single-planet system where I own the planet. I have reason to believe that my opponent has a plague card, so instead of storing the infantry on my planet, I store them in space instead.

Another player attacks me, I use all 7 infantries as ships in the fight, and he manages to take out my carrier, so after the fight ends, I'm left with 7 infantries and a flagship.

My question is, do the 4 excess infantries that are above capacity die in space (remember, they were stored in the space area before the fight!), or can I reassign them to my planet after the fight?