There were many versions of the ending of I am Legend, depending on the writing style and storyline. There were two possible endings: Version 1: The protagonist finally defeats the evil forces and saves the world, but in the process, he loses his beloved. After completing the rescue, he found that he could not go back to the past because he had already made a change. He could not go back to the past and change what had happened before. Therefore, he decided to stay in the present and continue to fight and adventure in this world with new beliefs and goals. Version 2: The protagonist finally defeated the evil forces and saved the world, but his actions were condemned by the world. He was forced to leave the world after the rescue because his actions were deemed immoral or unjust. He eventually became a wanderer who traveled around the world to help people in need and tried to find a balanced and just world.