A Portland man whom police have warned about in the past because of his history of masturbating in public and assaultive behavior will be released from prison Friday.

Steven Ricci, 51, who owns a house at 915 Brighton Ave., will be allowed to live on his own while on probation, with extensive conditions imposed by his probation officer a day before his release.

Ricci, who was born with brain damage and has cerebral palsy, struggled during an interview last week at the Maine Correctional Center in Windham to answer whether he thought he would reoffend after spending about two years in prison.

At the beginning of the half-hour interview with a prison guard in the room, he acknowledged writing a letter to the Cumberland County Courthouse in Portland asking a judge to revise his sentence to keep him in prison because he was concerned that he couldn’t stop himself from reoffending. The court apparently did not act on Ricci’s written request, although that can’t be confirmed because the case file created from that request is not public.

“I think I didn’t want to go home and blend in with the community, and I don’t want my neighbors or my family to be worried about me,” Ricci said, explaining his reason for writing the letter to the court.

Ricci’s speech is impaired and often difficult to understand. He became animated during the interview, banging the table with his hands and raising his voice to the point the guard told him to quiet down.

But by the end of the interview, Ricci said he was hopeful that he has received enough counseling and treatment since he was sentenced to prison in 2013 that he wouldn’t reoffend.

“Don’t worry about me. I got two years of treatment that I never had in the past,” Ricci said. “I’m hoping I’ll go home Friday, and I’ll go about my life.”

The last time Ricci was released from custody from the Cumberland County Jail, in August 2012 after completing a sentence for misdemeanor indecent conduct, he was arrested within a week for masturbating on his front porch.

After he was released from jail in March 2012 after serving time for public masturbation, he was arrested twice on new charges within three weeks.

This time, Ricci’s probation officer, Christopher Arbour, imposed numerous probation conditions to ensure he is under close supervision at all times.

Ricci has completed a two-year prison term imposed on Nov. 1, 2013, on a felony charge of assaulting a medical worker. The judge suspended a portion of the 44-month sentence so it would be hanging over Ricci as he serves his probation term.

Ricci appeared in the Cumberland County Courthouse on Thursday before Judge E. Mary Kelly and accepted Arbour’s new strict probation terms.

The new conditions require him to comply with GPS monitoring. He cannot go where children gather, such as parks, playgrounds, schools and daycare centers. He cannot go to public trail systems. He must abide by a curfew, not use alcohol, drugs or possess weapons. He has to submit to random searches by probation officers or any police officer. He must undergo counseling and treatment. He cannot have house guests or tenants unless approved by the probation department.

Assistant District Attorney Jennifer Ackerman said this week that authorities have struggled to find a way to address Ricci’s behavior because there is no appropriate state treatment facility.

“Every time he gets out, everybody gets on high alert for a reason,” Ackerman said. “The criminal justice system is not the answer in terms of long-term treatment for him.”

Defense attorney J.P. DeGrinney, who represented Ricci off and on over the years, said last week that the state lacks resources or a place to address Ricci’s needs.

“The entire time I’ve represented Steven, he has always maintained that he wanted help, that he has issues,” DeGrinney said.