On November 12, 1955, moments after witnessing Doc vanish with the DeLorean from a lightning bolt, Marty McFly (from 1985) learns that Dr. Emmett Brown (also from 1985) was transported to 1885 and is trapped.[N 1] Marty and the 1955 Doc use the information in Doc’s 1885 letter to find and repair the DeLorean so that Marty can return to 1985, as Doc’s letter instructs Marty not to come back for him. Marty spots a tombstone with Doc’s name, dated six days after the letter, and learns that Doc was killed by Biff Tannen’s great-grandfather, Buford. Marty photographs the tombstone and travels to 1885 to save Doc.
Marty arrives on September 2, 1885, in the middle of a Cavalry pursuit of Indians. When the DeLorean’s fuel line is torn, Marty hides the car in a cave and walks to Hill Valley. He meets his Irish-born great-great-grandparents, Seamus and Maggie McFly, and runs afoul of Buford and his gang. Buford attempts to lynch Marty, but Doc rescues him. Doc agrees to leave 1885 after seeing the photograph, but without gasoline, the DeLorean cannot reach 88 mph (142 km/h).
Doc devises a plan to use a train locomotive to push the DeLorean up to the required speed. While he and Marty explore a rail spur they intend to use, they spot a runaway horse-drawn wagon. Doc saves the passenger, Clara Clayton, and the two fall in love. At a town festival, Buford tries to kill Doc, but Marty thwarts him. Buford insults Marty and challenges him to a showdown in two days; in his anger, Marty accepts. Doc warns Marty not to get provoked by name calling and lets it slip that Marty gets into a car accident in the future. Doc’s name in the photograph of the tombstone is erased but the date and tombstone itself still remain.
Marty and Doc place the DeLorean onto the spur. Doc makes Marty promise that once he returns to 1985 the DeLorean will be destroyed, but Marty convinces Doc to leave with him. Unable to convince Clara that he is from the future, Doc is spurned. He goes to the saloon for a binge. Doc drinks a single shot of whiskey and passes out. Buford arrives and calls out Marty, but Marty observes “Clint Eastwood” (his 1885 alias) appear on the tombstone in the photograph, so he refuses to duel. Doc awakens after drinking the bartender’s special “Wake-Up Juice” and tries fleeing with Marty, but Buford’s gang captures Doc, forcing Marty to duel. After fooling Buford into thinking he has killed Marty using a bulletproof plate, Marty knocks Buford into a wagon of manure and Buford is arrested for an earlier robbery.
As Clara leaves on the train, she overhears a salesman discussing how heartbroken Doc was. Clara applies the emergency brake and returns to town. She discovers Doc’s model of the time machine and rides after him. Stealing the locomotive at gunpoint, Doc and Marty begin pushing the DeLorean along the spur line. Clara boards the locomotive while Doc climbs toward the DeLorean. Doc encourages Clara to join him, but she falls, hanging precariously by her dress. Marty passes his hoverboard to Doc so he can save Clara. They coast away from the locomotive as it falls off an unfinished railroad bridge; Marty travels to 1985 on the completed bridge (now called Eastwood bridge).
Marty arrives on October 27, 1985, escaping the powerless DeLorean before it is destroyed by an oncoming train. He discovers that everything has returned to the initial post-time travel timeline, and finds Jennifer sleeping on her front porch. He uses the lessons he learned in 1885 to avoid being goaded into a street race with Douglas J. Needles, avoiding a possible automobile accident. Remembering that this accident would have sent Marty’s life spiraling downward, Jennifer opens a fax message she kept from 2015, and watches as its text regarding Marty’s firing disappears.
As Marty and Jennifer examine the DeLorean wreckage, a flying steam locomotive equipped with a flux capacitor appears, manned by Doc, Clara, and their two children Jules and Verne. Doc gives Marty a photo of the two of them by the clockworks in 1885. Jennifer asks about the fax, and Doc tells them it means that the future has not yet been written. Doc and his family depart aboard the locomotive to an unknown time in the past.