A Florida man has been found dead in his apartment after allegedly barricading himself inside and shooting at police officers in an hours-long standoff.

Police surrounded the Panama City apartment on Tuesday afternoon, exchanging gunfire with an assailant who shot a rifle from an elevated position, according to Bay County Sheriff Tommy Ford.

Multiple officers were pinned down during the exchange, which started around noon in the small resort city.

Police eventually called in an armoured vehicle to reach the residence, and used explosives to break down the door, Mr Ford said. They used a robot to search inside, confirming that the suspect – 49-year-old Kevin Robert Holroyd – had died.

Mr Ford would not say whether Mr Holroyd had killed himself or been shot by police. He did say that officers heard a muffled shot from inside the apartment, after which they had no further contact with the suspect.

He added that Mr Holroyd had “boobytrapped” the apartment, covering it in gasoline and trying to set it on fire.

“We were just blessed that we didn’t lose multiple officers and citizens today,” Mr Ford said at a news conference, calling the standoff a “nightmare scenario for us”.

No officers were injured in the shoot-out, Mr Ford said, but one bystander was injured while running out of her apartment. She was in stable condition as of Tuesday afternoon.

The standoff started when 30-year-old Clinton Street was shot to death in neighbouring Santa Rosa Beach on Tuesday morning. Police followed Mr Holroyd, the suspect in the shooting, to the apartment complex, where he barricaded himself inside.

The Bay and Walton County sheriff’s offices both responded to the scene. Officers from the Florida Department of Law Enforcement, Florida Highway Patrol and Florida Fish and Wildlife Conservation Commission also assisted, according to Florida Governor Rick Scott.

Witnesses said that they saw Swat team members responding to the shooting incident, and that they heard more than 50 shots being fired. Two schools in the area – St. Andrew School and Lucille Moore Elementary – were placed on lockdown, according to Bay District Schools. The police response also blocked traffic to at least one road.

“The deputies and officers that responded to this are absolute heroes,” Mr Ford told reporters that afternoon. “…Every officer from these surrounding agencies knew they were arriving into a situation where their life was at risk, and they came anyway.”

“I just have so much respect for the job that they do every day,” he added.