CARTHAGE, Tex. — Richard Linklater could not have imagined a more bizarre final scene for “Bernie,” the dark comedy film he directed, than the one that unfolded Tuesday in East Texas. After nearly two decades behind bars, the convicted killer on whom the movie was based was driven away from the jail (by Mr. Linklater no less) to a home in Central Texas owned by — you guessed it — Mr. Linklater.

The convict, Bernie Tiede, 55, in plain clothes for the first time in 17 years, slid into the front seat of the S.U.V. that Mr. Linklater had rented for the four-and-a-half hour drive. Mr. Tiede fiddled with an iPhone — flashy new technology to him — as he settled in for the ride from the rural, piney woods of Carthage, Tex., near the Louisiana border, to Mr. Linklater’s modest home in an eclectic Austin neighborhood. Along the way, he stopped for brief but emotional reunions with friends he had not seen in years, and a meal at a Mexican restaurant, where he held a fork for the first time since 1997.

Mr. Linklater had always thought a life sentence was too harsh for Mr. Tiede. But he never thought that his 2011 film about the strange crime would lead to an early release.

“It was a dream, but only a dream,” Mr. Linklater said. (Mr. Linklater is a major donor to The Texas Tribune.)