YORK, Maine — Economic uncertainty, fueled by a growing disparity between the haves and have-nots. A perceived enemy both far away and close to home whose religious beliefs and very appearance are anathema to you, and who seem to act irrationally or without conscience. A government who you find you can’t trust because it has engaged in a wholesale cover-up of facts that are important for you to know.

America in the 21st century?

Actually, Salem, Massachusetts, in 1692.

There is nothing new under the sun, said Emerson Baker, a Salem State University history professor and York resident who has spent the past 20 years studying the infamous Salem witch trials.

“The fact is, the witch trials underscore the dangers of extremism and rushing to judgment,” he said. “We see it repeatedly throughout time, and we see it today. If there’s someone who is different and if a problem happens, maybe they’re responsible.

“Google the word ‘witch hunt.’ You will find every writer, every talking head, every politician left, center and right drawing analogies to witch hunts,” he said.

Ripped out of today’s headlines, for instance, is a story in Al Jazeera America about the fear of a “witch hunt” against Muslims after the Charlie Hebdo attacks in Paris.

All of the ingredients for a society taken over by extremism certainly existed in spades during late 17th century Massachusetts, said Emerson — themes he explores in his new book, “A Storm of Witchcraft.”

“The fact is it was a storm,” he said. “There were problems with the government. There were problems with war. There were problems with the economy. All these terrible things were happening. The agents of the Pope [the French] were conspiring with the minions of Satan [Native Americans] and driving people out of New England. Quakers were settling in Puritan Massachusetts. God is testing us and, quite frankly, the devil is winning because we are not devout enough.”

The story of the Salem witch trials is well known, at least broadly, to most Americans — reaching a popular audience in the 20th century with the production of Arthur Miller’s “The Crucible.”

What began in January 1692 with the strange behavior of two teenage girls, the daughter and niece of Salem Village minister Samuel Parris, spread to a small group of young females who were “afflicted” — many of them poor servant girls who were orphaned. Soon, they began accusing their neighbors of witchcraft — in 17th century Puritan Massachusetts as for centuries before in Europe, believed to be very real.

‘Satan was winning the war’

The context, said Baker, is critical. Many of the initial accusers came from the poorer parts of Salem Village, while many of the accused were “from the more up and coming part of town.”

Witchcraft was tied, he said, to the economic uncertainty of its time, with crop failures rampant and poverty extensive.

Moreover, King William’s War being waged by Native Americans with help from their French allies at the “frontier” of Maine and New Hampshire created another level of uncertainty. Puritans were being assaulted and killed, certainly a harbinger from God.

The same month Abigail Williams and Betty Parris made their initial accusations, York came under attack. The Candlemas raid on Jan. 24, 1692 — launched from Snowshoe Rock, which is actually today near Baker’s Old Scituate Road property, ended in the deaths or kidnapping of hundreds of settlers.

Word of the attack would have soon reached Salem, said Baker. Among those killed was a Puritan minister.

“The destruction of this prosperous shire town shocked residents of Massachusetts; if York could fall, most towns north of Boston were vulnerable. The death of the first Puritan minister at the hands of Native Americans was an ominous sign that Satan was winning the war against Massachusetts,” Baker wrote.

Whatever caused the initial hysteria and whatever caused its spread among the teenagers, Baker said it didn’t take long before the accusations spread beyond Salem to Andover, Billerica, Haverhill, Massachusetts, and the number of the accused began mounting.

Trials began almost immediately and continued throughout much of 1692. The judges were not lawyers, but prosperous merchants and politicians of their time, and many were among the closest personal advisers to Gov. William Phips. Moreover, some had land holdings in the “frontier” that they’d lost, and some were military and political leaders who were responsible for the “failed policies” in the frontier war that threatened their way of life.

“Their losses, and the colony’s, would have left them looking for someone to blame,” Baker wrote. “Sad to say, under such circumstances, it is often human nature not to look within but to look outward. The judges did just that, preferring to hold Satan and his minions accountable for their situation.”

In the end, 172 were accused of witchcraft and 19 were executed. Several others died in prison. In the months that followed, pamphlets critical of the court’s decisions were published.

Phips, realizing the government would lose authority if people thought it had wrongly imprisoned more than 100 people, imposed a publications ban.

“Curbing the free speech about the witch trials was a key element of what effectively became the first large-scale government cover-up in American history,” said Baker.

The saddest part of this entire chapter of American history, said Baker, is that those who proclaimed they were witches were freed while those who held steadfast to their innocence were put to death.

“Honestly, this is the story of 25 people who lost their lives over this. This is a story that needs to be told, of people who were unwilling to compromise and died for their beliefs,” he said. “It’s a powerful story.”

The witch trials, he said, remain a cautionary tale for every person.

“Every generation of people around the world is convinced the times in which they live are so much better than the bad old days, and we don’t do things like that anymore,” he said. “The fact is that even though we have modern science and technology, it’s your bias that will get you every time.

“The moral of the story is that there needs to be more understanding of each other and a better understanding of the world before we make our opinions,” he said.