It started innocently, as such things usually do. Cheerful chatter, then flirting. A call to an inmate’s daughter on his behalf. Joyce Mitchell was flattered by the attention she got from the two inmates at the New York maximum-security prison where she worked as a tailor shop instructor and was happy to reciprocate with favors for the men.

But then the favors grew bigger and riskier as did the stakes of their relationship, Mitchell told police in a series of voluntary statements obtained by NBC News. Tools were bartered for the promise of a painting. A swift kiss exchanged in secret, then more intimate sexual encounters. Soon Mitchell was smuggling hacksaw blades into the prison, plotting to kill her husband and planning to run away with the two convicts.

“I was caught up in the fantasy,” she reportedly said.

At the last minute Mitchell panicked, she said, checking herself into a hospital rather than showing up to drive the getaway car. But that didn’t stop the two inmates, convicted killers Richard Matt and David Sweat, who hacked their way out of their Clinton Correctional Facility and set off on their own. As hundreds of law enforcement officers scoured several states for the fugitives and the nation watched in white-knuckled suspense, Mitchell was questioned, arrested and charged with aiding in the two men’s escape.

[New York prison escape: Scenes from a manhunt]

On Tuesday, the same day her confession became public, Mitchell, 51, pleaded guilty to the charges against her. Clad in a black-and-white prison uniform not so different from the ones she once mended at the Clinton facility, she tearfully accepted the terms of her plea agreement, under which she faces a prison sentence of 27 months to seven years and a $6,000 fine, according to the New York Times.

[Manhunt ends as second escaped convict is shot, captured by police]

The saga of the manhunt finally over — Matt was shot and killed by federal agents on June 27, three weeks into the search, and Sweat was captured two days later — attention has now turned to Mitchell’s involvement in the brazen escape. What could possibly have compelled her to conspire with such brutal men?

In her police statements, Mitchell describes her gradual descent into their scheme.

She began working near Matt, 48, and Sweat, 34, in the fall of 2013, and they got along well. The two men were nice to her, she said, they made her feel special. Sweat was eventually moved to a different workshop, out of suspicion that he and Mitchell were having a relationship (though they weren’t at the time, Mitchell said). But Matt remained, and the two became close. Mitchell began reaching out to Matt’s daughter as a favor to him.

Convicted murderers David Sweat, left, and Richard Matt escaped from the Clinton Correctional Facility on June 6 using power tools and going through a manhole. (New York State Police via Getty Images)

For months, that’s pretty much all they did, until November 2014, when Mitchell asked Matt — reportedly an accomplished artist — to paint a portrait of her three kids as an anniversary gift for her husband. In exchange, Matt began asking for things. In hindsight, they were clearly tools — a set of padded gloves, two pairs of eyeglasses with lights attached — but at the time Matt offered an innocent explanation for the requests. He and Sweat wanted to paint at night, he told her, according to the documents.

The relationship escalated from there, Mitchell recounted. Mitchell began bringing in baked goods for Matt. In April, he grabbed her while the two of them were alone and kissed her for the first time.

“It startled me,” she said. It also frightened her — her husband worked at the facility as well.

When Matt asked for a screw driver bit shortly after, she brought it to him without question.

[‘How could she do this?’ husband says of prison worker charged with aiding escape]

In May, Matt approached Mitchell for oral sex, and she consented. On several other occasions, he came to her desk wearing a coat with a hole cut in it, through which she could touch his genitals. Mitchell also gave several notes “of a sexual nature” to Matt to pass along to Sweat, including photos of herself naked.

Mitchell is hardly the first person to become infatuated with a violent criminal. Convicted killers Charles Manson and Ted Bundy received thousands of love letters — Manson very nearly got married this year to one of those women, but let his marriage license expire before tying the knot.

The phenomenon is common enough that psychologists have a name for it: hybristophilia, or sexual attraction to someone who has committed an “outrage” — lying, cheating, rape, robbery, murder. John Money, a prominent sexologist who was one of the few people to study the phenomenon, wrote that hybristophiles often encourage their lovers to commit crimes because they’re turned on by the idea of violence against another.

But Brenda Smith, a law professor at American University and project director for a Department of Justice program on addressing prison rape, says relationships between inmates and guards are neither as unthinkable nor as pathological as we may think.

“The people who are in custody are people who committed a crime, as opposed to their whole identity being the crime that they committed,” she told New York public radio station WNYC. “The reality is that relationships can develop. Admiration can develop.”

As a PhD candidate at Colorado State’s Department of Leadership, Research and Foundations, Susan J. Jones interviewed four women who had relationships with inmates while working at correctional facilities. She found that the women felt isolated in their jobs, where they are typically surrounded by men, and that a relationship with an inmate gave them a sense that they were cared for. One woman told Jones that her relationship made her feel “special and loved” — much as Mitchell’s did.

[Richard Matt, the dangerously charismatic escapee at the center of the N.Y. manhunt]

Meanwhile, inmates have their own reasons for seeking out connections with those who guard them. The flip side of hybristophilia is the phenomenon of the “turner,” analyzed in a 2003 paper for the journal “Deviant Behavior.” Turners are inmates who develop relationships with staff in order to extract favors, sow discord at the facility or find true romance.

In the complicated, isolated, fraught context of a prison, the lines between these various phenomena can be blurred. Staff may be attracted both by an inmate’s violent past and his or her present kindness. Inmates may truly feel for corrections officers while also seeing an opportunity to exploit the relationship for benefits.

Psychologist Elie Godsi told the BBC that prisons are artificial environments where people act in ways that seem unfathomable to the outside world. The fact that relationships there are forbidden makes the motivation for having one all the more complex.

“These are not normal relationships, these are rose-tinted,” he said.

Clinton Correctional Facility is seen on June 18 in Dannemora, N.Y. (Andrew Burton/Getty Images)

In Mitchell’s case, by the time her relationship with Matt and Sweat lost its rose-tinted hue, she was in too deep to back out. She told police she realized that they were carving a hole in their cells by May, but didn’t feel that she could do anything.

“I was already bringing stuff in to him, and didn’t really feel I could stop,” she said.

As the inmates’ requests became more and more brazen — they asked for hacksaw blades, chisels and a punch — Mitchell began carefully concealing the smuggled tools in packages of hamburger meat. Tubes of paint were added to the bag with the meat so that if it set off the prison’s metal detector, guards would assume it was merely the metal on the packaging, she said.

According to the original plan, Mitchell was to drug her husband — who Matt referred to as “the glitch” — with a pair of unidentified pills. After he was asleep, she would drive her Jeep, packed full of clothes, a gun, tents and other equipment; pick up the escapees at a designated spot; and drive them away. On June 5, Matt told her that the day had arrived.

“I panicked,” Mitchell said, “and couldn’t follow through with the rest of the plan.”

That night Mitchell drove to the local hospital, where she was admitted for an overnight stay. When she checked her phone around 11:30 the following morning, she found message after message from her family. The police were looking for her, they said.

A day later, she was at the New York State Police station in Malone, N.Y., admitting her involvement to investigators.

“I believe I helped Inmate Matt and Inmate Sweat escape because I was caught up in the fantasy,” she told them. “I enjoyed the attention, the feeling both of them gave me and the thought of a different life.”