A 12-hour standoff between police and a man who had a gun in the parking lot of a Burnsville Costco store ended peacefully early Thursday.

Burnsville Police said the situation ended just after 5 a.m. and there was no threat to the community.

The department’s Special Weapons Team used “nontactical” means to bring “a scary situation” to an end, said Sgt. Matt Smith.

The man, who police said was 39, did have a gun, but no shots were fired, Smith said.

“He was in crisis,” Smith said. “I hope he gets the help he needs.”

Roads that had been closed around the store reopened Thursday morning.

Officers were called about 5:30 p.m. Wednesday about a suicidal man with a gun in a car near the store’s gas pumps.

At least five agencies responded, including SWAT teams from Burnsville and Eagan. A police sniper appeared to be watching from the Costco gas station roof as a police drone flew overhead.

Burnsville police warned people to stay out of the area.

As darkness fell, half a dozen residents clambered atop a nearby hill to get a better view of the scene, which spanned several blocks.

Sanaa Hersi, a local educator, was returning home when she found squad cars blocking her street.

“Hopefully it ends well,” said Hersi, who has lived there for six years.

Andrew Nystrom, a resident who saw the flashing lights while heading home from work in Savage, wondered if the police response was too much, calling it “a little excessive for a single suicidal male.”