PALM BEACH, Fla. — As a judge in New York considers whether to let Jeffrey Epstein out on bail while he awaits trial on a new round of sexual assault charges against teenagers and young women, details of the last time the financier was incarcerated have come under increased scrutiny.

That incarceration, in Palm Beach County, involved special accommodations — including work release for 12 hours a day, six days a week, at a foundation he had recently created — that were allowed because Epstein could afford to pay for them and because his high-powered legal team insisted on them.

Epstein, 66, was arrested July 6 on federal charges in New York that he sexually abused dozens of children from 2002 to 2005. The charges are similar to ones he faced in Florida 12 years ago.

But in Florida, Epstein and his lawyers convinced prosecutors, including then-U.S. Attorney Alexander Acosta, to allow him to plead guilty in state court to procuring a person under 18 for prostitution, a second-degree felony, and to felony solicitation of prostitution, a third-degree felony.

Epstein’s legal team also hashed out an unusual punishment for the financier: Instead of being sent to a state prison, where felony sex offenders normally serve time, the negotiated settlement stipulated that Epstein serve 18 months in the county jail and a year of an alternative to incarceration called community control.

At a news conference last week, days before resigning as U.S. secretary of labor, Acosta distanced himself from the accommodations Epstein had in jail, saying “the work release was complete BS.”

A handwritten addendum to the plea agreement reached with state prosecutors specified where Epstein would serve his work release, a release that he had not even been granted at that point. Epstein was to spend those hours at an office in West Palm Beach that housed a nonprofit foundation Epstein set up just before he was sentenced. The Florida Science Foundation, which state records show was established to award scholarships and research grants, dissolved soon after Epstein’s sentence was completed.

Epstein’s privileges began almost immediately after he reported to Palm Beach County Jail. He spent just a night there.

He was then transferred to the lower-security Palm Beach County Stockade, several miles west. Epstein didn’t spend much time there, either, thanks to the pre-negotiated work-release deal. After three months in the special “T-dorm” of the stockade — reserved for inmates who need to be kept from other inmates and requested by Epstein’s attorneys — Epstein was granted work release.

His personal driver was authorized to pick him up from the stockade every morning, six days a week, at 8 a.m., the sheriff’s office said. Epstein was then driven to the Florida Science Foundation office 11 miles away and returned by 8 p.m. He stayed at the stockade on Sundays and holidays.

A deputy was assigned to be with Epstein at all times that he was out of the stockade. Epstein paid the sheriff’s office $128,136 for the deputies who accompanied him to his office. The deputy was required to wear a suit, not a sheriff’s uniform, and to drive an unmarked car, records show.

Granting Epstein work release privileges has raised questions. According to the sheriff’s office, registered sex offenders are never given work release from jail. Epstein’s negotiated settlement says he was designated a sexual offender the day he signed the deal — June 30, 2008.

Sheriff’s spokeswoman Teri Barbera told The Washington Post this week that Epstein was not considered a registered sex offender until after he finished his sentence.

Palm Beach Sheriff Ric Bradshaw, who was in office while Epstein was serving his sentence, declined to be interviewed about the case, which was brought back to public attention by a Miami Herald investigation last year.

In April of this year, he allowed a documentary team to record an interview with his second-in-command, Chief Deputy Mike Gauger. The department recorded the interview and released the video last week.

“We were given Mr. Epstein under conditions that we were not used to,” Gauger told the documentary crew. “Instead of being sentenced to a state prison, it was negotiated between the federal government and the state that he would serve his time in a county jail, which was ours.”

Gauger said Epstein’s circumstances required “special precautions.”

“The precautions were because of his extreme wealth, his notoriety. His legal staff that he had was enormous,” he said.

Epstein’s lawyers asked that he serve his time in the special wing of the stockade, Gauger said. Even then, he said, they complained. “His lawyers visited and then were very unhappy with the confines of the T-dorm,” he said.

An attorney for Epstein’s accusers claimed at a news conference last week that Epstein assaulted a young woman while he was in the custody of the Palm Beach County Sheriff’s Office.

“He wasn’t just in jail. He only slept there,” attorney Brad Edwards said. “He was in his office most of the day, and what I can tell you, he had visitors — female visitors.”

At least one of those visits “was for improper sexual conduct,” Edwards said. Edwards said he got that information from victims, “including one who personally visited him.”

Barbera said she had no knowledge of any assault while Epstein was in custody, saying “our eyes were on him all the time.”

Epstein’s lawyers did not immediately respond to a request seeking comment on Edwards’s claim.

Gauger told the documentary crew that before Epstein was granted work release, he served three and a half months at the stockade, most of the time in another special category: houseman, granted to him for his “excellent behavior,” Gauger said.

“He had to sweep the floor, mop the floor, collect the dinner trays, wash the windows, wash the windowsills, pick up the dirty linen and replace it with clean linen to all the different inmates,” Gauger said.

Epstein’s good behavior continued once he was on work release, the sheriff’s office says, and his sentence was shortened by five months as a result.

Epstein “was given gain time because of his good behavior, just like any other inmate,” Gauger said.

He was put on house arrest, at his Palm Beach waterfront estate, until his sentence was completed on July 21, 2010.