Mr. Lawson, of the F.B.I.’s cyber division, said the bureau’s official position was that victims should not pay ransoms. But many city officials and computer network specialists say that cities often have no choice. The cost for recovering data can far surpass the ransom demand, and agencies often find themselves unable able to perform the most basic municipal tasks. In some cases, even emergency services have been affected.

[Cities are wrestling with whether to pay ransoms to hackers.]

“These groups are always trying to find that sweet spot: What is enough someone will consider paying but not so much that they’ll say, ‘Forget that. It’s easier to rebuild,’” said Mark A. Orlando, the chief technology officer for Raytheon Intelligence Information and Services. “This is a situation where that amount is going up, and we have reached a new high-water mark as to what is getting paid out.”

It is unrealistic to think cities can maintain firm “no ransom” policies, he said. “Anyone who said that has never been in charge of a municipality that has half their services down and no choice.”

The League of Cities began offering insurance coverage a few years ago, after seeing hackers attack private businesses, said Eric Hartwell, deputy general counsel and insurance counsel for the Florida League of Cities. “We kind of foresaw the exposure,” Mr. Hartwell said. “Cities are in the limelight.”

In Lake City, the information technology director, blamed for both failing to secure the network and taking too long to recover the data, wound up losing his job. He declined to be interviewed.

Nearly a month after the attack, the database built by Ms. Sikes and her team is still largely inaccessible. She said the I.T. workers have been unable to tell her when, or if, it will be recovered — so they are waiting. “I’m not getting a lot of sleep,” she said.