"Birthright" is a two-part episode from the 6th season and it was written by Brannon Braga.
The Enterprise docks at DS9 to assist in repairing Bajoran aqueducts. Geordi and Worf sit down for a meal at that space station and Geordi, not being too impressed with the food, decides to go to one of the kiosks while Worf munches down. There, an alien being named Jaglom approaches Worf and tells him his father Mogh is still alive and being held at a Romulan prison camp. He offers to take Worf there for payment. Worf is insulted and insists that a Klingon would rather die that live in a prison camp.
Meanwhile, Dr. Bashir (a regular from Deep Space 9) has some equipment from the Gamma quadrant he has brought aboard the Enterprise to examine using the ship's superior technology in which to test it. Data offers to help him with it in Engineering. He, the doctor, and Geordi test the equipment which gives off a plasma discharge that renders Data unconscious for 30 seconds, during which time he experiences a dream like vision and meets his creator Dr. Soong doing work that resembles a blacksmith in his shop.
He recovers and ponders his experience by making art inspired by it and asks Dr. Bashir and Geordi to help him recreate that experience using the equipment to enter another altered state. This time, the dream is longer and he gets more detail, including birds. He meets Dr. Soong who tells Data that he has awakened a new state of consciousness in his evolution. "You are the bird," Soong tells Data.
After a discussion with Data in Ten Forward about his dream experience with his father, Worf decides to seek out the truth about his own father and goes back to find the one who offered to bring him to his father.
When they arrive on the prison colony, Worf discovers the Klingons and Romulan captors living together as a community. He learns the story that the Klingon's families were told they were all killed in the Battle of Kitamor for their honor. Because Worf now knows about this place, he is being forced to stay and not leave. The Romulan commander who leads the colony explains to Worf that outsiders are not to learn of the place because it could damage the peaceful existence they have there. He tells Worf he chose to stay with the Klingons to escape the wars and they in turn chose to stay and have their families believe them dead to protect their honor.
Worf's presence begins to have an influence on the young Klingons, some of whom are the protect of interracial marriage between Romulan and Klingon, and shows them how to engage in Klingon games of sport and hunting. He gathers them together one night and tells them ancient stories of warriors and about honor and duty. He teaches them the meanings of the songs they were taught to sing but not to understand.
When the head Romulan named Tokath tells Worf he has two choices, either accept their ways or die, Worf chooses the latter. He is set to be executed the next morning. As he awaits death, Worf tells the crowd that they may kill him, but the knowledge and inspiration he brought them about their heritage will live on in them. It is already too late.
Then, the young Klingons one by one stand next to Worf and tell the elders if Worf dies, they will die with him. Tokath's wife, a Klingon, tells him to reconsider and let the young ones leave with Worf if they choose.
Worf, along with several young Klingon colonists, are beamed aboard the Enterprise, ready to explore their homeworld. In order to protect the honor of the remaining colonists, Worf tells Captain Picard that the ones brought aboard were survivors of a crash landing and that there were no other survivors. Picard says he understands.
I liked the dream sequences with Data the most in this episode because the subject fascinates me and I've kept a dream journal for years. What I liked best about the other story line was that it shows Worf not as a perfect character, otherwise seen as a hero in the series, but as a being with many flaws including prejudice that he learns to overcome when he discovers a young Klingon woman he falls in love with is half Romulan, and the daughter of Tokath. She doesn't understand how his feelings could change with that knowledge. He has no answer, except that that's the way it's always been. He leaves the colony with a new perspective. The actors who played the young Klingons were exceptional.