Sign up for our COVID-19 newsletter to stay up-to-date on the latest coronavirus news throughout New York City

A Windsor Terrace man found himself under lock and beside key-cutting machine when a hardware store employee closed up shop for a prayer break, trapping the unlucky customer inside.

For 45 harrowing minutes, Mike Brennan was stuck inside Brooklyn Hardware Supply last Friday after the shop’s lone employee pulled down the Prospect Avenue store’s roll gates so he could visit a nearby mosque.

It all started when Brennan made a mid-afternoon visit to the store to buy some bolts. As he walked in, he saw a worker lowering the gate over the window, but Brennan paid it no mind.

He spent a few minutes wandering the tiny store, and the next thing he knew, he heard another roll gate go down behind him.

That’s when he realized he was trapped.

“No one ever said ‘Is there anyone in the store?’ No one turned the lights off,” said Brennan. “Suddenly, I was just locked in alone.”

A trip to buy bolts became a harrowing experience for Mike Brennan, a Windsor Terrace man who found himself locked up inside a hardware store. Photo by Paul Martinka

Brennan — an elevator repairman with plenty of experience freeing people from confined spaces — knew he had to find a way out.

First he attempted to bang on the door to attract attention, but no one heard the rattling.

Next, he tried to find an escape route through the back of the shop, but that failed, too.

Brennan then unsuccessfully searched the shop’s counter for an employee’s phone number.

Finally, with nothing but every tool on the hardware store’s shelves at his disposal, Brennan resigned himself to Plan D.

“I said to myself ‘I think I have to call 911 here,’ ” he said.

Brooklyn Hardware Supply store owner Abdul Motin unlocks his Prospect Avenue store — bringing an end to the brief imprisonment of a shopper trapped inside. Photo by Paul Martinka

After calling cops, Brennan got his first lucky break of the day: the store’s owner showed up before the fire department arrived to knock down the door.

Kamrul Motin, the worker who accidentally locked Brennan in the shop, said he’s been diligent about praying several times per day during the Muslim holy month of Ramadan — which is why he cut out in the middle of the day.

Brennan said he’s hip to religious customs, and he’s happy that Motin is Muslim.

“I know a Jewish guy who owns a hardware store, and he closes up early on Fridays and doesn’t come back for the rest of the day,” Brennan said.

Motin was apologetic after the incident, but he doubts it will hurt his relationship with Brennan as a shopper.

“He lives right behind the store,” said Motin. “He’s a good customer.”