Former Cook County State’s Attorney Anita Alvarez has repeatedly denied that her decision to charge Chicago Police Officer Jason Van Dyke with murder in the shooting death of 17-year-old Laquan McDonald was motivated by a looming election — an allegation most recently leveled in court last month by Van Dyke’s lawyer.

But before her announcement on Nov. 24, 2015, that the white cop was being charged with killing the black teenager, Alvarez’s political campaign consultants weighed in on how to present the decision, and she was given key talking points, according to emails obtained by the Chicago Sun-Times.

One campaign consultant, Ken Snyder, emailed what Alvarez should say if reporters asked her views on Black Lives Matter, a group that had been speaking out about violence against African-Americans by police, the emails show.

Snyder also came to the county’s offices to help “prep” Alvarez before a news conference about another police shooting, sources told the Sun-Times.

Some members of the state’s attorney’s staff felt uneasy about such mixing of campaign interests with Alvarez’s official duties, the sources say.

Cook County ethics rules bar county officials from “working on a campaign for elective office” while on the clock for taxpayers.

Alvarez didn’t respond to requests for comment.

Ken Snyder. | Snyder Pickerill Media Group

Snyder says he provided “unsolicited” advice to Alvarez ahead of the news conference announcing Van Dyke was being charged with first-degree murder but that the prosecutor’s campaign team had nothing to do with the decision itself to charge the cop.

The political consultant says he learned Van Dyke was being charged a day or two before the announcement.

“I would never try to offer a sitting prosecutor advice on what to do, I’m not qualified . . . I have no legal background,” Snyder says.

He also says Alvarez wouldn’t have let politics influence such an important decision.

An email chain — obtained through a public records request by the Sun-Times from the state’s attorney’s office, now run by Alvarez’s 2016 Democratic primary rival, Kim Foxx — began the evening of Nov. 23, 2015.

The emails came after Sun-Times columnist Michael Sneed wrote a story, appearing online that evening, reporting that charges against Van Dyke were expected the next day.

Sneed noted in the story that, days earlier, the Rev. Jesse Jackson had called for a “police shakeup from top to bottom” and for Alvarez’s resignation over her perceived inaction in the high-profile case.

Laquan McDonald. | Provided photo

McDonald was killed on Oct. 20, 2014. He was shot 16 times by Van Dyke as the teenager, a knife in hand, was walking away from officers, according to police dash-cam video that a judge ordered be made public over objections from Mayor Rahm Emanuel’s administration.

Sneed’s article said Alvarez and her staff had “huddled” over the weekend to discuss the case — something Alvarez campaign adviser Hanah Jubeh took issue with as she emailed several of Alvarez’s outside political consultants, including Snyder.

“We need to correct her on this huddled garbage,” Jubeh wrote. “That’s ridiculous.”

Alvarez joined in on the email conversation, writing shortly before 10 p.m. to the same consultants and also including her campaign manager Mike Carson, Dan Kirk, who was the No. 2 prosecutor in Alvarez’s office, and Sally Daly, who was the state’s attorney’s press secretary — apparently at their non-governmental email addresses.

“WTF? Is she implying that Jesse pushed me to make this decision?” Alvarez wrote. “Are you kidding me?”

Daly wrote back: “NO — not at all stop reading this nonsense. We are going to have a good day tomorrow.”

Around 5:30 a.m. on Nov. 24, 2015, the day of the news conference, Snyder emailed Daly that Cook County Commissioner John Fritchey had asked on Facebook why charges had taken so long. Alvarez had been accused by some critics of being too pro-police, reluctant to hold Chicago cops accountable for excessive force and other misconduct.

While City Hall paid more than $500 million in settlements and legal expenses over allegations of abuses by police officers in recent years, Alvarez’s office rarely prosecuted them, records showed.

Sally Daly. | LinkedIn

Snyder wrote that he’d responded to Fritchey by saying “all police involved shootings require long, meticulous and thorough investigations. Ten to twenty months is absolutely the norm. The federal investigation into this matter, led by the U.S. Attorney, is still on going! . . . The last thing you want to do is rush charges and get them thrown out because you didn’t dot an i or cross a T. It’s understandable, however, for those who have never prosecuted a murder case, much less a police involved murder case, to think these things should or could move faster.”

Daly emailed Snyder: “got it.”

Snyder sent Daly an Internet link about five people having just been shot at a Black Lives Matter event in Minneapolis. Daly asked him what Alvarez should say if “asked about the black lives matter movement and how she feels about it.”

Snyder responded that Alvarez should reply this way: “I agree with them. I’ve spent my . . . career standing up for victims of crime the majority of whom are people of color. . . . As the first person of color to hold this office, I’ve ushered in historic criminal justice reforms that will hopefully create an environment in the future where groups like BLM have nothing to protest . . . but this sad occasion proves we are not there yet . . . not even close.”

Campaign consultant Ken Snyder’s emailed advice for how then-Cook County State’s Attorney Anita Alvarez should respond if asked her views on Black Lives Matter.

While the emails were apparently all on private accounts, it appears that Daly forwarded the chain to her county email account on the morning of the Van Dyke news conference. It was from there that Foxx’s office released the emails under the Illinois Freedom of Information Act, the state law that requires most government documents be released on request.

Daly wouldn’t comment.

Hours after the news conference, Emanuel’s administration complied with the judge’s order and released the dash-cam video from a squad car that recorded the shooting.

What the video showed was at odds with the account that initially was released by the police union, whose spokesman said McDonald lunged at officers and Van Dyke defended himself, and with the accounts of officers at the scene.

After the video’s release, the city exploded into days of protests, some leading to scuffles and arrests.

Jason Van Dyke (right) and attorney Daniel Herbert on Nov. 6 at the Leighton Criminal Courts Building. | File photo

As recently as at a court hearing last month, Van Dyke attorney Daniel Herbert accused Alvarez of charging the officer as a result of public pressure and political concerns, with the 2016 election ahead of her.

In March 2016, Foxx beat Alvarez in the Democratic primary and went on to defeat her Republican opponent the following November.

Snyder says the McDonald case was a matter of great importance not only to the public but also to the campaign.

Foxx had criticized Alvarez over how long it took to charge Van Dyke, and that became a key issue in the campaign.

Weeks after losing the primary and amid criticism over whether her office could be objective, Alvarez asked a judge to put the Van Dyke case in the hands of a special prosecutor — a lawyer outside her office — a request the judge granted.

The special prosecutor ended up refiling criminal charges — also adding charges — against Van Dyke. Alvarez’s defenders point to that as evidence she was right to charge him.

Van Dyke, who has pleaded “not guilty,” is awaiting trial.

MORE FROM THE WATCHDOGS: ‘Independent’ city watchdog Faisal Khan’s secret backer? Right-leaning policy group