STONINGTON — Who knew actor Ted Danson, famous for his role as bartender Sam Malone on “Cheers,” had a connection to Stonington Borough?Not many people, until the PBS show “Finding Your Roots” dug into the star’s background in the third episode of its fourth season, which aired Tuesday night. Each episode of the program traces the family tree of two or more celebrities, usually revealing unexpected ties to historical events or famous personages.Tuesday’s episode was no exception, with host Henry Louis Gates Jr. revealing that William H. Macy’s seventh great-grandfather was part of a group of men who purchased and settled the island of Nantucket in 1659, and that actress Mary Steenburgen, Danson’s wife, had a fifth great-grandfather who fought under George Washington in the French and Indian War.But Gates’ revelations about Danson’s family hit much closer to home.In 1761, Oliver Smith, Danson’s fifth great-grandfather, built a home at 25 Main St. in Stonington Borough. Smith and his wife, Mary Denison, sister of Edward Denison, had 16 children, according to Stonington Historical Society records. Oliver Smith is listed as one of the descendants of Nehemiah Smith, who arrived in Plymouth sometime before March 1637.When apprised of this connection on the episode, Danson was floored.“That’s huge. Somebody like me 300 years ago making their way in the world,” Danson said. “I hope they’re not turning over in their grave. An actor?”“I think they’d be proud,” Gates said.Building a home, though, wasn’t Oliver Smith’s claim to local fame. That came on Aug. 30, 1775, just after the start of the American Revolution, when four British gunboats sailed into Stonington Harbor and launched an attack. Under siege in Boston, the British were in dire need of supplies and had taken to plundering towns along the New England coast.Smith, a lieutenant colonel in the local militia, commanded a tiny force that repulsed the British attack and saved the town from destruction.Danson marveled as he read a small placard with details of the attack.“I never envisioned one of me out there in the Revolution,” he said.Smith also had a prominent role in one of the most inspiring stories in the annals of local history.On the show, Gates showed Danson a record of Smith’s purchase, from a local man named “Miner,” of a slave named Venture sometime around 1760. He allowed Venture to work for his own wages, and later allowed him to purchase his own freedom.After Venture bought his freedom, he took the last name Smith and later bought the freedom of his wife, Meg, and children who had been born in slavery.Venture Smith, of course, is well-known in the area, and nationally, because of the 1798 publication of the pamphlet “A Narrative of the Life and Adventures of Venture, a Native of Africa.” In it, the former slave details his journey from Africa, where he was enslaved at age 7, to America, where he grew up on Fishers Island. After a failed escape attempt from his Fishers Island master, Venture was sold to a man in Stonington — presumably the man named “Miner” — before Oliver Smith acquired him. After Smith granted Venture his freedom and just before the American Revolution, he moved to East Haddam, Conn., where he owned and operated a successful farm and other businesses and lived with his family.“It’s hard to read something that is so everyday about purchasing people. And owning people,” Danson told Gates.“But your ancestor let him work and make money and keep the money and purchase his own freedom,” Gates countered.“Even that’s weird,” Danson said. “Your ancestor had choices … I mean he owned a man who was his property … he didn’t have to treat him with dignity,” Gates replied.“I get it. I get that this is America, and this is where we came from, and this is where …,” Danson said, his voice trailing off.“But unlike the founding fathers … George Washington, Thomas Jefferson … your ancestor freed a slave before the American Revolution. … What’s it like to find that out?” Gates asked.“Complicated,” Danson said quietly.You can view Season Four, Episode Three of “Finding Your Roots,” titled “Puritans and Pioneers,” at the pbs.org website at https://www.pbs.org/video/episode-3-puritans-and-pioneers-dfypdx/. Catherine Hewitt contributed to this article.