According to Madara, Nagato is a descendant of the Uzumaki clan. During the Second Great Shinobi World War, Nagato lived with his parents in a village near Amegakure. One day two Konoha shinobis broke into their home looking for food, unaware that the place was still inhabited. Nagato's parents, believing they were going to killed, attacked the two so that Nagato could scape. Having mistaken them to be enemy ninjas, the konoha ninjas killed his parents. In his grief, Nagato awakened his Rinnegan and killed the assailants. He would come to consider this the First Great Pain Of His Life.
With his family gone, he started wandering the country, going from house to house asking for food. In time he met a dog named Chibi and, later, Konan and Yahiko, who began traveling with him in his search for food. One day, Chibi was killed in the crossfire from Hanzou's fight with The Soon-to-be Sannins. Nagato mourned his death and promised himself that he would change that world. When the war ended, the three orphans ran into the Sannins. Rather than returning to Konoha with his team-mates, Jiraya decided to teach the three how to look after themselves.
Soon after Jiraya happened to live with the orphans, Nagato and Yahiko were attacked by an Iwagakure ninja. Nagato reactivated his Rinnegan to defend Yahiko, killing the ninja. When Jiraya found out about this, he decided to train them in ninjutsu. Nagato was very emotional about killing the ninja, and asked Jiraiya for help so he could protect Konan and Yahiko. Jiraiya's response was for Nagato to grow up and to use his eyes to find the peace that they both desired for the world. Three years later the orphans had become competent ninjas, so Jiraiya returned to Konoha.
Over the years, news of the three's exploits would reach Jiraiya which often consisted of the death of someone who opposed the
m; eventually he received word that they had all died. In truth, Nagato, Konan, and Yahiko began a quest to find peace. They became Full-fledged Amegakure ninjas and gathered followers who shared their philosophies of an end to war. Hanzou, the leader of Amegakure viewed the group as a threat to his rule and schemed with Konoha's Root to eliminate them. Claiming to want to discuss peace, Hanzou lured Nagato, Yahiko and Konan to an ambush. There he forced Nagato to cho
ose between killing Yahiko or Konan. Not wanting to force Nagato to make the choice, Yahiko impaled himself with a kunai that was placed in Nagato's hand. With Yahiko's dying breath, he told Nagato to survive, because he believed in Jiraya's words that Nagato would become the world's savior. This would become the second great pain of Nagato's life. Devastated, Nagato retrieved Konan and Yahiko's body and launched an attack against Hanzou's men. With the Summoning: Demonic Statue of the Outer Path he was able to kill all but Hanzou. However, the technique left Nagato emaciated, with numerous chakra rods embedded in his back. He severed his loyalties with Amegakure by scratching through the symbol of his Amegakure forehead protector, resolving to teach the village and the world his pain. Yahiko's body would later be incorporated into The Six Paths Of Pain as the Deva Path.
Upon adopting the alias Pain, Nagato led the rebelling forces in the Amegakure civil war, and took control of the village by assassinating Hanzou. Then he solidified his leadership by systematically killing anyone who had ties to the former leader. At some point, he assisted Uchiha Madara in the creation of Akatsuki, using Amegakure as his base of operations.