PORTLAND, Maine — An apparent security breach that allowed a Cumberland County Jail inmate to sneak into another cellblock for an alleged sexual encounter over the weekend is under investigation.

The incident occurred in the jail’s maximum security unit at a time of day when all inmates are required to be secured in their cells, Cumberland County Sheriff Kevin Joyce said Monday in a news release.

The inmates involved in the rendezvous were identified as Arien L’Italien, 23, of Biddeford, and Karla Wilson, 25, whom authorities describe as a Portland transient.

L’Italien is a federal inmate being held for probation violation. He was arrested in Portland in late January after allegedly firing a handgun at members of the U.S. Marshals Maine Violent Offender Task Force as they attempted to arrest him on Mellen Street.

Officers returned fire and struck L’Italien in the leg. At the time of the incident, he was wanted on a felony arrest warrant charging him with aggravated assault in Biddeford. He also was on probation for felony theft.

Wilson is awaiting trial for four counts of gross sexual assault and two counts of aggravated assault.

According to published reports, Portland police arrested Wilson and Shawn Bacheldor, 27, last August in connection with the rape of a 24-year-old local woman. Police said at that time that the victim knew her alleged attackers.

Both inmates’ cells were on the same level of the maximum security unit, separated by a walkway and two security doors.

The breach was detected shortly before 1 a.m. Saturday, when a corrections officer on the overnight shift spotted L’Italien crawling on the floor of the unit’s second level, apparently trying to get from one cellblock to another unnoticed.

A check of recorded video surveillance footage showed that L’Italien entered the women’s maximum security cellblock about an hour earlier and was on his way back to his own cellblock, the news release said. He had to maneuver through four doors to gain access to Wilson’s cell in the women’s cellblock.

Corrections officers at the jail perform visual and welfare checks on every occupied cell every 15 minutes, the sheriff’s department said.

L’Italien, however, arranged his bunk to look as though he were in it and had manipulated the lock on his cell in a manner that went undetected by officers. Wilson manipulated the lock on her cell in the same manner in anticipation of L’ltalien’s visit, the news release said.

Investigators said they believe that the two inmates know each other through friends and were interested in a sexual encounter.

A preliminary investigation showed that L’Italien had somehow communicated with Wilson through the jail ventilation system and arranged for her to manipulate the lock on her cell door so the door would not lock completely.

L’Italien then sneaked out out of his cell block and into Wilson’s, where authorities believe the two had consensual sex, the sheriff’s department said.

L’ltalien now is being held in the facility’s “super max,” while Wilson is being segregated in the intake unit.

A review of video footage and an examination of the two cellblocks suggest that the location and design of the corrections officers’ station, as well as “some lack of attention to detail” by the officers on duty at the time, played a major role in the security breach, the news release said.

The Cumberland County Sheriff’s Department is conducting an internal investigation to see if any policies may have been violated and which policies should be changed as a result of the event.