Not every celebrity can trace their roots back generations, but the ones who can often find that their history contains plenty of acting, singing, and other talents. For some, however, diving deep into their ancestry results in surprising discoveries.

The question is whether celebs' ancestors were on the right side of history or not. After all, plenty of awful things have happened throughout history, and the most pivotal moments involved plenty of drama, angst, and even sacrifice. Including the Salem Witch Trials, in fact.

People have always been fascinated by witches (just consider the cult following of 'Witches,' a piece by Roald Dahl), but imagine being tied to those tried in Salem.

Thanks to shows like 'Who Do You Think You Are?', high-profile celebs are learning about their history, including witchy ancestry. Other sources, like census records and handwritten accounts, are also helping many people shape their genealogy and even their identities.

As NBC highlights, 'Who Do You Think You Are?' (executive produced by Lisa Kudrow, no less) tapped historians and other experts to take celebs on "poignant" searches that often end with surprising tales of the past.

For celeb Sarah Jessica Parker, the past was particularly surprising. SJP appeared on an episode of 'Who Do You Think You Are?' and learned more than she expected about her family's history.

RELATED: Sarah Jessica Parker Honors Civil Rights Hero In Her Latest Insta Post

As Ancestry recapped, Sarah Jessica Parker went on the genealogy show to learn more about her mom's ancestry. Barbara Parker (formerly Keck) ran a nursery school when SJP was growing up, and though she recognized her German and English ancestry, there was far more to the story.

With a combination of newspaper records, census information, and written accounts, Sarah Jessica was able to track down an ancestor who traveled to California during the Gold Rush. Diving deeper into her history, SJP found information that connected her family to accused "witch" Esther Elwell.

As the story goes, Esther, who is Sarah Jessica's 10th great grandmother, was "condemned as a witch" based on an eyewitness account (by a 17-year-old girl) that she acted as a "spectre" to harm another person. That was back in the 17th century, of course, and also totally fabricated.

Fortunately, Sarah Jessica's family history doesn't have an entirely tragic end: Esther Elwell was essentially acquitted when the powers that be decided women could no longer be tried for witchcraft.

But what an interesting legacy to have and pass along to Sarah Jessica's kids. Stories of strong women no doubt inspire the way she's raising her twins, and her Gold Rush relative might serve as inspiration for her children (including son James), too.

As for how the discoveries impacted SJP? Ancestry quotes the actress as saying the details changed "everything about who [she] thought [she] was."

NEXT: This Is The Reason Fans Don't Believe Sarah Jessica Parker Is Raising 'Humble' Kids