Where, when and why did the myth that cats have '9 lives' originate?

by thisstressedmeout

I'm assuming it has something to do with Ancient Egypt. As someone who is creeped out by cats in general, it scares me to think that there was a period of time in which I could have been born where it was widely believed you could kill a cat 8 times and it could still come back to maul you.

JJVMT

As a follow up, why does the number of lives vary by language and culture (for example, in Spanish-speaking countries, cats have "seven lives")?