Star Trek Next Generation: All Good Things
The only chance to save mankind lies with Captain Picard. An old enemy has granted him the power to revisit his life as it was seven years before, and to experience his life twenty-five years in the future. With the help of friendships that span time and space, Picard struggles to defeat the plans of the Q Continuum. But even as he fights to save the human race from total extinction, he has been set up to be the unwitting agent of mankind's destruction.
In an effort to save humanity, Picard must sacrifice himself and all those he commands and if their sacrifice fails all mankind is doomed.