A Nassau judge who freed a jail inmate accused of trying to lure teens into making pornography — citing costs of the cancer patient’s care in custody — now has ordered the man’s house arrest after his guilty plea to less serious felonies.

Court records show Andrew Quattrone, 33, of Lindenhurst, received a judge’s commitment for a prison sentence of 1 1⁄2 to 3 years in prison after pleading guilty April 14 to two felony criminal solicitation charges.

Acting State Supreme Court Justice Terence Murphy also decided Quattrone won’t be jailed before sentencing, despite prosecutors’ objections, as the defendant continues treatment for acute lymphocytic leukemia.

Instead, Murphy ordered Quattrone to wear a GPS monitoring bracelet before sentencing, saying the man only can leave his family’s Suffolk home for medical care and religious services.

In March, the judge had canceled Quattrone’s $500,000 bail and released the inmate on his own recognizance even though the district attorney’s office called the defendant “a danger to children” and “risk to society.”

At the time, Murphy referenced the county having to pay for Quattrone’s medical care, along with the cost of correction officers keeping a 24-hour watch on the inmate in a private hospital.

On April 14, Nassau prosecutor Christine Guida asked the judge to approve the plea offer “in the interest of justice,” saying the families of the two 14-year-olds Quattrone victimized “felt it was best that their daughters not have to testify at a trial.”

The judge said the cost of Quattrone’s care for the county was only one of “myriad factors” he had considered while deciding the man’s custody status, and called the risk of the man’s flight “remote.”

advertisement | advertise on newsday

“By all accounts the defendant is facing death if he fails to strictly follow a medical protocol that has been set for him by experts in the field of cancer,” Murphy said in court.

Police arrested Quattrone in February 2015 after they said he approached two girls in Massapequa Park and asked if they’d make an “adult video” with him after showing them explicit photos and condoms.

A grand jury indicted Quattrone on felony counts of trying to use a child in a sex performance and criminal solicitation, along with misdemeanor child endangerment charges.

At the time, Quattrone already was facing a 2014 misdemeanor charge for allegedly going to a Levittown school and lobbying an 18-year-old to be in a porno. He later pleaded guilty and got 90 days in jail.

In 2009, Nassau police arrested Quattrone while he was out on bail in a gun case and charged him with trying to solicit sex acts from three girls, ages 12 to 14.

He later pleaded guilty to reduced charges — which didn’t require sex offender registration — and got 2 to 4 years in prison.

State law shows the plea bargain that prosecutors recently struck also means Quattrone again won’t have to register as a sex offender.

Quattrone’s attorney, Joshua Kahn, didn’t respond Wednesday to requests for comment. Prosecutors declined to comment.

advertisement | advertise on newsday

A court spokesman said Quattrone’s sentencing will happen once medical personnel and authorities find he can be taken into custody and continue to get uninterrupted treatment during his incarceration.