NEW LONDON — When Shaun Cooley tried to hold up a 7-Eleven convenience store on Route 32 in Franklin in December, police said, the cashier thwarted the robbery by running into the office.

So minutes later, police said, Cooley robbed a Shell gas station a short distance away on West Town Street in Norwich and fled with more than $400.

Cooley, 36, agreed to a plea bargain Wednesday in New London Superior Court in both robbery cases, as well as a larceny case from August 2012 in which he is accused of stealing his ex-girlfriend’s debit card and taking more than $10,000 from her account, according to Assistant State’s Attorney Lawrence Tytla.

The Norwich man faces a sentence of five years in prison followed by five years of special parole on two charges of second-degree robbery and one charge of second-degree larceny. All the sentences are concurrent, meaning that will be his total sentence as well. He is scheduled to be sentenced Jan. 7.

Cooley made the guilty pleas in the two robbery cases under the Alford Doctrine, meaning he does not admit the claims made by police and prosecutors are true, but acknowledges there likely is enough evidence to convict him at a trial.

Cooley’s sentence will be added to a two-year sentence he is serving for a January 2011 burglary in Plainfield.

The 7-Eleven was held up at 4:35 p.m. Dec. 17. According to a police affidavit, Cooley, carrying a handgun, entered the store and demanded money from the register.

The clerk ran into the office and locked the door, police said, leaving Cooley unable to open the cash register. He threw the register to the floor behind the counter, police said, left the store and sprinted behind it into a nearby field, only to reappear a few minutes later at the Shell station.

Cooley also previously was accused of joining with James Goins, of New London, to rob a BP gas station less than half a mile away from the 7-Eleven on Route 32 in Franklin on Oct. 28, 2012.

Police said Goins went into the station carrying a knife, while Cooley waited for him in a car parked nearby. Goins was sentenced Oct. 22 to two years in prison for that crime.

Goins told police that he and Cooley met while at the Stonington Institute for treatment of their heroin addictions. He said that after the BP robbery, he and Cooley drove to New London and bought drugs using the stolen cash, police said.