In Nagato's memory, Shimada Hanzo, a mountain pepper fish, was afraid that the expansion of Xiao's power would threaten his dominant position, so Shimada Hanzo decided to frame Xiao. Shimada Hanzo threatened Nagato with peony, and Yahiko let Nagato kill himself to save peony. In extreme anger, Nagato used the eye-turning to summon an alien golem, and Shimada Hanzo, a mountain pepper fish, fled.
Extended data
After Yahiko's death, Nagato became the leader of Xiao, and made the six paths of Payne, the puppet of the corpse, by using the eye-turning. Yahiko's body was made by Nagato into Pain Tendo among the six paths of Payne, which was used to command Xiao's organization.
After Payne was defeated by Naruto Uzumaki one by one, Naruto found Payne's ontology-Nagato in a big tree made of paper in Xiaonan, and the two sons of prophecy finally met.
Naruto wanted to know Nagato's past and find the peaceful answer from Nagato's experience. After Nagato told Naruto about the two great pains of his life, the death of his parents and the death of his best friend Yahiko, Naruto took out the first book, Perseverance and Endurance, written by Jiraiya. The writing inspiration of Perseverance and Endurance Biography comes from a disciple of Jiraiya, who is Nagato.
After some conversation, Nagato was influenced by Naruto, regained his boyhood dream, abandoned his original plan with Uchiha Obito, revived the people who died in Payne World War I with the skill of heresy and reincarnation, and entrusted his will to Naruto and died of exhaustion.
References:
Baidu Encyclopedia-Nagato (the character in the Japanese anime Naruto)