Origin of Pain

is episode 173 of the Naruto: Shippūden anime.

Synopsis
Nagato continues telling his story to Naruto and describes the memory of his second pain. Nagato describes how Jiraiya taught them ninjutsu, and also privately told Nagato that he, with his Rinnegan, was the reincarnation of the Sage of the Six Paths. After Jiraiya leaves, the three orphans grow up and start an organisation, led by Yahiko, dedicated to bringing peace to Amegakure. Hanzō, the leader of Amegakure, decides that Yahiko's group is a threat to his rule. Hanzō kidnaps Konan and tells Nagato that he must kill Yahiko if he wants Konan to live. Nagato remembers what he said, "I just want to protect those two."! For making Yahiko wait for long, he shouts at Nagato while Konan pleads to not kill him. Yahiko immediately drives himself onto the kunai that Hanzō threw in front of Nagato, killing himself for Konan's sake. Nagato is horrified by Yahiko's death and uses his Rinnegan to summon the Demonic Statue of the Outer Path to defeat Hanzō's men and Danzō's Root shinobi.