MILFORD — A New Haven man convicted by a jury in the botched robbery of a local burger restaurant will spend nearly two decades behind bars.

Judge Peter Brown sentenced Gregory Mclaurin to 25 years in prison, to be suspended after he serves 18 years Sept. 26.

Mclaurin will also serve five years of probation after his release from prison.

A jury had convicted Mclaurin at a July trial on charges of first-degree robbery, conspiracy to commit first-degree robbery, criminal possession of a firearm, possession of a pistol without a permit, four counts of unlawful restraint and conspiracy to commit fourth-degree larceny.

The 18-year term is double the prison time Mclaurin and co-defendant Royshon Ferguson were offered in May to plead guilty in the case.

Police said that on Jan. 19, 2018, McLaurin and Royshon Ferguson, 21, entered SmashBurger on the Boston Post Road.

Mclaurin pointed a .22-caliber handgun at employees and customers and ordered them into the kitchen. Mclaurin then ordered the manager to the safe, where she started unloading cash as he threatened to shoot her in the head, according to testimony at trial.

However, one customer refused the robber’s orders and instead drew his legal firearm and pointed it at Mclaurin, police said.

The armed customer then chased a panicked Mclaurin out of the kitchen according to the police account. Then, with Mclaurin out of the way, the customer held Ferguson down and was able to knock the handgun out of his grasp.

Mclaurin and Ferguson then made a dash for the exit. Police soon found the pair hiding in the woods nearby.

While this was going on, police said two restaurant employees helped themselves to the cash left behind by the robbers. The pair were later arrested on larceny charges.

Mclaurin’s lawyer declined to comment Tuesday.

State’s Attorney Margaret Kelley said she thought the judge’s sentence was fair and appropriate given the circumstances of the case. None of the people in the restaurant during the stickup spoke in court, but some sent statements about the ordeal to court officials prior to the sentencing.

“I think Judge Brown was very moved by the input from the victims,” Kelley said.

Ferguson, 23, has pleaded guilty to charges of conspiracy to commit first-degree robbery, carrying a dangerous weapon and possession of a pistol without a permit, according to court records. His sentencing is scheduled for Oct. 31.