The mayor of a Florida town was arrested Thursday after he opened fire on deputies who were trying to serve a search warrant for allegedly operating an illegal medical practice at his home.

Pasco County Sheriff Chris Nocco said SWAT officers showed up to the house of Port Richey mayor Dale Glen Massad on Thursday morning to serve a warrant related to allegations that he was still practicing medicine despite having his medical license revoked more than 27 years ago.

When SWAT tried to enter the home, bullets began raining down on the officers.

COLD CASE DETECTIVES CHARGE FLORIDA MAN WITH MURDER IN WIFE’S 1979 DISAPPEARANCE IN WISCONSIN

Officers did not return fire. Eventually, Massad surrendered to police and was taken into custody. No one was injured.

“He’s lucky he’s not dead,” Nocco said during a press conference Thursday, according to FOX13. “Every day those members put their lives on the line. They’re lucky to go home.

He said Massad has a history of drug use, violence and threats and owns several guns, which is why deputies raided the 3,200-square-foot, waterfront home rather than make a routine arrest.

NIKOLAS CRUZ, PARKLAND SCHOOL SHOOTER, MIGHT GO ON TRIAL IN EARLY 2020, JUDGE SAYS

The sheriff said there is a suspicion that the mayor may have been under the influence of drugs at the time of the shooting. He also said Massad yelled at officers that he was not going back to jail.

“When somebody says 'I'm not going back to jail' that either means it's going to be a shootout, they're either going to flee from us somehow...or possibly suicide by cop," Nocco said. "He's the one who made the decision to shoot [at] us. He's the one who is going to jail."

According to FOX13, the 69-year-old Massad was previously arrested in August on a domestic battery charge. Massad now faces charges for attempted murder and practicing medicine without a license.

CLICK HERE TO GET THE FOX NEWS APP

Port Richey is a town of 2,800 about 40 miles north of Tampa on the Gulf Coast. Massad was elected mayor in 2015 and served on the city council from 2000 to 2008.

The Associated Press contributed to this report.