Justin Jones, a black student and activist in Nashville, was arrested in February during a protest over a statue in the State Capitol of Nathan Bedford Forrest, a Confederate general and early member of the Ku Klux Klan.

But days later, he was surprised when he was told that he had violated the terms of his bail, which stipulated that he avoid contact with Republican House Speaker Glen Casada.

Prosecutors had filed a motion seeking to have his bail revoked — which would send him to jail — because they said he had sent an email to Casada after his arrest.

But Jones says that he hadn’t sent Casada any emails since his Feb. 28 arrest. And when he and his lawyer began asking the Nashville District Attorney’s office to show them the email, prosecutors dropped the motion, he said.

A report from local television station News Channel 5 disclosed why last week: Prosecutors had been sent a reproduction of the email that was dated March 1, even though it had been sent nearly a week before. The person that sent it to them was Cade Cothren, Casada’s chief of staff, the District Attorney’s office said.

The disclosure kicked off a chaotic week in Nashville that now threatens to bring down Casada, who observers say has helped bring the state’s House on a Trump-esque pivot to the right since he became speaker in January.

The News Channel 5 story had voiced questions about whether the email had been tampered with in an effort to frame Jones, the activist. And it had also disclosed text messages sent by Cothren that included memes about black people and statements such as “black people are idiots,” as well as the use of the n-word.

Days later, the station reported that Cothren admitted to using cocaine in his legislative office. And other reports soon came out that documented a series of sexually explicit text messages attributed to Cothren between 2014 and 2016, in which he allegedly solicited sex and nude photos from an intern, sought sex with a lobbyist and suggested he would make sexual advances toward another intern a few years ago.

Casada’s participation in some of the text messages — he had made a sexual remark about a woman in a photograph Cothren sent him and asked Cothren once if he was “a minute man,” after Cothren had bragged about a sexual encounter at a restaurant, according to the Tennessean — has kicked off calls for his resignation.

The messy political drama is another chapter in the long-running discussion about the treatment of women in the halls of power, in this case the State House in Tennessee.

Cothren resigned on Monday night; he was reportedly being paid a $199,800 salary. He did not respond to a request for comment sent to his legislative email address. Multiple members of Casada’s staff did not respond to requests for updated contact information for Cothren.

In a statement distributed to media outlets earlier in the week after the disclosures about drug use, he said he adopted “maladaptive coping mechanisms.”

“Like so many young, egotistical men aspiring to a career in politics that came before me, moving up the career ladder was met with unrelenting stress, peer pressure and unrealistic expectations. I know that this is not an excuse,” Cothren said.

Some Republican members of the House began to break ranks on Wednesday, with a handful joining Democrats in saying he should resign. Others have called for the caucus to hold a vote of confidence on his speakership.

Casada initially defended Cothren and downplayed his own involvement, echoing President Trump as he dismissed the texts as “base locker room talk.” But he has since struck a more remorseful tone.

“I take complete ownership over the text messages with inappropriate comments about women that I exchanged with my former Chief of Staff and another individual several years ago,” he said in a statement distributed Wednesday by Doug Kufner, a spokesman for the House Republican Caucus. “It’s embarrassing and humbling to have it displayed in this manner."

Casada said that he learned about the Cothren’s offensive texts “alongside the general public as they were reported.”

Keel Hunt, a columnist at The Tennessean and former reporter who has written two books about politics in the state and used to work for Republican Sen. Lamar Alexander, described the week’s events as a “mess.”

“There’s a sense that we’re being embarrassed,” he said. “Taxpayers, citizens are having to read about this kind of craziness in the national newspapers.”

He said that the scandal had touched on concerns about the way Casada had defended Republican legislators who had been accused of sexual misconduct in the past, including a man he picked to be the chairman of an education subcommittee recently despite allegations that the man had sexually assaulted three women when they were players on a high school basketball team he coached.

Questions about Jones’s email remain. A special prosecutor has been appointed to investigate the question of whether reproduction of the email was tampered with, which could potentially be a felony crime.

Casada has said the email was “not edited in any way, shape or form.”

Cothren has called allegations that the email was tampered with “blatantly false.”

Kufner forwarded an email from Vinay Dattu, the director of information services for Tennessee’s General Assembly — the State House and senate — about a preliminary investigation into the email issue.

Dattu said that Jones’s emails, along with many others, were being marked as spam, and had only been released on March 1 after Cothren made a complaint to the IT department about a week before.

“In summary, Cade Cothren did not receive the e-mail from Justin Jones dated February 25th, 2019 @9:09 AM with the Subject: RE: Justin Jones until we (LIS) released the e-mail on March 1st, 2019,” Dattu wrote.

It is not clear why the email reproduction forwarded to the District Attorney’s office included the time stamp of March 1, regardless of when it was delivered.

Emails released by the District Attorney’s office show Cothren following up with an assistant district attorney to raise questions about the time stamp on Jones’s email, asking him to hold off on his motion to revoke bail while the IT department investigated.

Jones told The Post that he’s consulted with some of his own IT experts and still believes the email was tampered with. He notes that if he and his lawyer hadn’t fought back, he’d be in jail as his case, a misdemeanor assault charge for allegedly throwing a cup of coffee at Casada, works its way through the system.

He said he believes his treatment is part of a system of bias at the capitol, one that allowed things like the Forrest statue to stand and a restrictive voter registration law to pass.

“There is a privilege in the fact that while I was instantaneously charged with something, and a motion to revoke my bond was filed without second guessing it, Mr. Cothren who has admitted to using drugs inside [the] capitol and was engaged in unethical behavior involving text messages, was allowed to gracefully step down,” he said. “Without any legal ramifications. And get thanked for his years of service.”