A man who took advantage of a security lapse at the Cumberland County Jail to have sex with a female fellow inmate early this year was sentenced Friday to 15 years in prison for robbing a bank.

Michel D’Angelo, 35, of Middleboro, Massachusetts, pleaded guilty in U.S. District Court in Portland on Feb. 13 to a federal charge of bank robbery for holding up Kennebunk Savings Bank in Berwick in 2012.

D’Angelo went into the School Street bank just before noon on Sept. 21, 2012, dressed in red women’s sweatpants, a sweatshirt and a wig with long brown hair. He told a bank teller that he had a bomb in his bag and would set it off if the teller pressed any buttons, according to a court affidavit filed by FBI Special Agent Thomas MacDonald.

He also used white surgical tape to cover a “Real Deal” tattoo on his fingers and a pink scarf to conceal a large “Karma” tattoo on his neck, the U.S. Attorney’s Office said.

D’Angelo, who goes by the nickname “Karma,” escaped the bank with $1,298.25 in a getaway car driven by his then-girlfriend, Jennica Miller, 23, of Thomaston, according to court records.

Miller pleaded guilty to a charge of aiding and abetting bank robbery and was sentenced on April 29 to 15 months in prison.

D’Angelo faced an enhanced sentence as a career offender for previous violent crime convictions, the U.S. Attorney’s Office said.

U.S. District Judge Nancy Torresen also ordered D’Angelo to serve three years of supervised release following completion of his prison sentence. The judge ordered him and Miller to pay $1,298 in restitution between them.

After D’Angelo’s arrest and while he was being detained on the federal charge against him, he was held at the Cumberland County Jail in Portland in the maximum-security unit, where male and female inmates are housed separately.

Corrections officers at the jail failed to follow jail policy on March 8 and left a pair of doors separating the male and female wings of the unit unlocked to make it easier to serve lunch, Cumberland County Sheriff Kevin Joyce said at the time.

D’Angelo and a female inmate, Renee Glantz, 23, of Windham, took advantage of that lapse. Each of them used cardboard from toilet paper rolls to keep the doors of their cells from closing properly. Glantz was able to pass through four doors that were supposed to be locked to make her way into D’Angelo’s cell for 3½ hours, during which they had consensual sex before a guard discovered them, Joyce said.

Neither Glantz nor D’Angelo will face criminal charges for their tryst, but did face sanctions from the jail, he said.

The security lapse was the second time in two years that inmates in maximum-security cells at the county jail managed to get out of their cells to have sex.

In March 2012, guards propped open the same two doors that were left unlocked in this year’s lapse, to keep the doors from slamming and making noise while they made security checks – a procedure that’s no longer allowed. In that incident, a male inmate tampered with the lock on his cell, got out and sneaked over to the female cellblock, where he had sex with an inmate. He was caught trying to get back to his own cell about an hour later.

A political action committee backing retired Maine State Police Sgt. Michael Edes, Joyce’s opponent in this month’s Democratic primary for sheriff, spent $100,000 on attack ads, including some that used those trysts as political ammunition against Joyce in radio ads and mailers.

Edes lost the June 10 primary, garnering 41 percent of the vote to Joyce’s 51 percent. Edes’ longtime friend Michael Liberty, who created a PAC, Citizens for a Safe Cumberland County, did not respond to questions about why he spent so much money on a relatively low-profile race.

Joyce, who is running for his second term as sheriff, has no Republican opponent on the ballot in November.