Is there a maximum gym time for Pokémon or do I have to wait until someone defeats it?

I have a question regarding the time a Pokémon can stay in a gym. I haven't found anything regarding this topic, so if this is a dupe I'm sorry.

Some background: I've been on vacation in Croatia and there was a gym on an island which isn't frequented by many players. I've battled it and put one of my Pokémon in.

This was 12 days ago and it hasn't returned yet :(...


Now to my actual question: Will Pokémon return from gyms after some time or do I have to wait until someone defeats it?


Solution 1:

There is no maximum gym time before a Pokémon is returned automatically. They must be defeated and reach 0CP before they will be returned to you.

The motivation system was mostly a way to get rid of the stagnation of the old gym system where people would sit in gyms for months on end, just collecting coins every day without actually really playing the game. Your Pokémon will not degrade to 0CP and return on its own, though-- it must be defeated by an opponent on another team.

From this article:

When a Pokemon loses its motivation, it is kicked out of the gym, but not immediately. Rather, even after the Pokemon’s motivation has gone down to zero, it still has to lose in battle one more time before it’s booted from the gym.