A California woman accused of impersonating her ex-boyfriend’s new wife in Craigslist “rape-fantasy” ads has been exonerated, after spending nearly four months in jail for a crime she never committed, authorities say.

Orange County prosecutors say 30-year-old Michelle Hadley was framed. Now they’ve charged the wife who falsely accused her with a slew of felonies, including 22 counts of falsely reporting a crime to Anaheim police.

Angela Maria Diaz, 31, faces kidnapping, false-imprisonment, and forgery charges in connection to the elaborate setup. She was also charged with one count of perjury for lying in a petition for a restraining order against Hadley.

Diaz was arrested in Phoenix last week and will be extradited to California, prosecutors said Monday. If convicted, she faces as much as 12 years and eight months in a state prison, and 11 years in a county jail.

“It’s often said that true life is stranger than fiction. The facts of this case make that statement spot-on,” District Attorney Tony Rackauckas told reporters.

“When a person who’s committed a crime gets arrested and charged, that’s a bad day. But when someone who’s innocent gets arrested and charged with a crime, that’s not just a bad day. It’s a nightmare.

“This is the tale of a woman who faced such a nightmare,” Rackauckas said.

Hadley was first arrested in June 2016, when police accused her of violating a restraining order obtained by Diaz, who also goes by the name Angela Connell. Back then, Hadley was released on $100,000 bail.

But cops cuffed Hadley again in July, after police claimed she was posing as Diaz in Craigslist ads soliciting “rape fantasies.” She was held on $1 million bond.

But authorities would soon learn that Diaz was sending herself the threatening emails, which included links to graphic images of dead and decapitated human beings, as well as aborted fetuses, Rackauckas said.

Hadley was finally released from jail in October, when prosecutors were already reexamining Diaz’s accusations.

The convoluted Gone Girl-style drama made national news, with Hadley’s mugshot plastered across the web. At the time, she faced life in prison for charges including six felony counts of attempted forcible rape.

Prosecutors had claimed Hadley repeatedly sent threats to Diaz, who was identified only as “Jane Doe” and as the pregnant new wife of Hadley’s former fiancé, a deputy U.S. Marshal whom authorities have not named.

During Monday’s press conference, Rackauckas said Hadley is “an innocent victim of a diabolical scheme.”

“This is a very detailed case. I wanted to make sure, however, that Ms. Hadley is cleared in every possible way—in the courtroom and in the court of public opinion. It should be clear in the media and in cyberspace,” he said.

Rackauckas identified Hadley’s ex only as “John Doe,” and said there is no evidence that he was involved in Diaz’s plot.

Diaz and John Doe were married in February 2016. Hadley dated John Doe from August 2013 to August 2015, investigators said.

Still, Rackauckas did not provide a motive in Diaz’s alleged frame-up.

“I don’t think we have a clear statement of what her motive might be,” the DA said, before adding, “You have a love triangle. Maybe a [desire] to put the dagger into the older relationship, but all that’s just speculation at this time.”

Diaz faces a host of other frightening accusations, including “faking a pregnancy” with John Doe, prosecutors say.

Police say Diaz altered a paycheck to give herself an extra $2,000 in April 2016. She also allegedly faked a cervical-cancer diagnosis, pretended to be an attorney, forged doctor’s notes, and impersonated two of John Doe’s ex-girlfriends over email.

According to prosecutors, Diaz sent emails to herself to make it appear Hadley was the author of the messages. She allegedly used Virtual Private Networks (VPNs) and third-party proxy servers to avoid detection, authorities say.

From June 1 to July 13, 2016, Diaz allegedly made false reports with police, claiming Hadley threatened her and the life of her unborn child. (A spokeswoman for the district attorney’s office said authorities do not believe Diaz was ever pregnant with John Doe’s child.)

An MBA student at Chapman University, Hadley was accused of providing men responding to the Craigslist ad with Diaz’s photos and details of her daily routine. Hadley was also accused to telling them “to have forcible sexual intercourse with [Diaz], even if she screamed or resisted,” the district attorney claimed at the time.

Now the DA says Diaz posted the ads herself, luring at least two men to her residence and calling 911. Cops “intercepted” the men intending to participate in the “rape fantasies”—incidents that appeared to bolster Diaz’s ruse.

Anaheim police also noted a visibly distraught Diaz had redness on her neck and breast area when she claimed a man tried to rape her, Rackauckas said.

“The police did a very thorough investigation,” Deputy District Attorney Richard Zimmer told The Daily Beast in July of last year. “What was presented to us… we have enough evidence to prove this case to a jury beyond a reasonable doubt.”

“This case just shows some of the dangers of social media and the online world we live in now,” Zimmer added.

Diaz’s story began to fall apart after Hadley’s defense attorney, Michael Guisti, worked closely with authorities to reinvestigate the source of the messages. They learned Diaz was sending herself emails from her hubby’s condo, her cellphone, and her father’s home in Arizona, Rackauckas said.

Guisti said Hadley is relieved by the dismissal of charges against her. “She was going about her business, getting her MBA, when all of a sudden this literally came out of the blue,” he told reporters Monday.

Hadley has been living at home since her release from jail and “laying low,” Guisti said.

Meanwhile, Michael Hadley had always declared his daughter’s innocence. Last year, he told The Daily Beast that he believed Michelle’s 38-year-old former flame was sabotaging her and accused Anaheim detectives of shoddy policework.

He said the ex-boyfriend was seeking revenge because his daughter filed a lawsuit to boot him from their condominium. “The marshal knows her email address,” Michael Hadley said in a July phone interview. “They were going to get married. They got the condo and everything else and it all fell apart.”

Hadley scoffed at portrayals of his daughter as vindictively jealous of her former beau’s new relationship. “What they’re saying is totally contrary to what’s going on,” Hadley told The Daily Beast. “My daughter could [not] care less.”

The ex-fiancé filed for a restraining order against Hadley in September 2015. His petition included a series of wacky emails that Hadley allegedly sent him, and that included biblical references and accusations of sexual assault.

“She frequently tells me ‘I fucking hate you’ and insults my manhood and sexuality,” he wrote in the document. He added, “most of our arguments end with [Hadley] self-medicating with an entire bottle of wine.”

One September 2015 message, which carried the subject line “Gone Girl,” included the rant: “You know exactly how God, the Word of God, the Spirit of God are involved with the condo. We both do.”

“Your end will come, and you will relinquish the keys to the earth,” Hadley allegedly wrote.

Her ex-boyfriend replied, “I am not sure how God, the Bible, or again, my childhood, has any relevance to the condo and mortgage.”

In June 2016, Diaz requested a restraining order against Hadley.

“Ms. Hadley has been emailing me for over one week, repeatedly threatening my life, my marriage, my safety, and slandering my husband,” she wrote in her filing. Diaz accused Hadley of using “over six different email addresses” to harass her.

“I am now fearful of leaving my home, have had to delete my online presence, and am incredibly emotionally distressed,” Diaz wrote.

“I am fearful of being ‘raped,’ ‘attacked,’ ‘killed.’ I have had to completely uproot my life, including missing work at a new job to quash this issue,” she added. “The tone and tenor of these emails escalates and there seems no sign of stopping.”

Diaz attached a collection of biblical-themed missives, which she claimed Hadley sent her via LinkedIn under the pseudonym “Jason Ray.”

“There are legends that Adam had a wife before Eve who was named Lilith, but this is not found in the Bible,” one May 2016 message began.

“YOU ARE NOT PERFECT, BUT YOU ARE THE EVE TO HIM… MICHELLE WAS THE TRUTH——HIS LILLITH [sic] BUT SHE AND THE OTHER WOMEN WOULD NOT SUBMIT TO HIS CONTROLLING WAYS,” the email continued.

Days later, another phony email warned Diaz that her new husband “is using you for everything.”

“Don’t you see this?” the message stated. “He is obsessed with me, I am his treasure princess, you are nothing.”