The troubles in Lake City, about an hour west of Jacksonville, began when several city employees reported that they had fallen for a phishing attack.

Employees at the city clerk’s office, water plant and airport had clicked on an email purportedly from one of their contacts that said something like, “you have an invoice ready.” It was personalized and looked legitimate, but it was really a spear phishing attack, using what is known as Ryuk “triple threat” ransomware.

One of the emails was cleverly disguised: It even made reference to a prior conversation the city employee had had via email, Mr. Hawkins recalled. The email had bypassed spam filters and antivirus software, which Mr. Hawkins said were both up-to-date.

“They were super crafty,” Mr. Hawkins said.

Mr. Hawkins took the city’s network offline, re-imaged the computers and took other normal precautions. But deep down, he knew that trouble could be looming if anyone else had clicked on the suspicious email without reporting it. The next sign of trouble emerged a few weeks later, on a weekend in early June, when the email system began running slowly.

Nobody works on the weekends at City Hall. So Mr. Hawkins waited until Monday morning to tackle the problem, but by then, it was too late. All of the city’s files were encrypted, and a note had been left on the city’s servers that read: “How do you want to open this type of file? Balance of shadow universe.”

Phones were down, email was out of commission, computers did not work and even the photocopiers were inoperable.

The hackers who had left the note subsequently asked for exorbitant sums of money to release the city’s data.