Fighting leopards

I had 2 leopard geckos that have lived together their whole life and last night they started fighting and one killed the other. Does anyone know why this happened? I want to avoid having this issue with my other leopards.

How old were they and how long did you have them? If you got them as juveniles and it turned out that both were males, this wouldn't surprise me. If they've been together for years, while it's not usual, sometimes gecko behavior toward each other does change. To be absolutely sure this doesn't happen again, keep them individually.

Sometimes behavior of geckos towards each other may change. I had two females, that were totally OK, no fighting, sleeping together in one place and so on. But when they started laying eggs, both were doing so in exactly same spot, so one female started to dig out eggs of the other and lay there her eggs. I think this caused one female that laid eggs first to hate the second one, I had to move her out permanently because of fighting (actually, the second one was not even trying to defend herself, just running away).

Maybe something happened that made your geckos fight each other, but as Aliza mentioned, they could be both males. More information will be useful.