“All of our emails were down in the city, and that was intentional,” said Rafael Benavides, a spokesman for the city. “We were trying to make sure that the virus was contained.”

Laredo’s email and computer systems are now fully operational, and the city was not one of the 22 cities targeted in the new attack. Laredo officials did not pay any ransom to get the system running again, Mr. Benavides said.

In the West Texas city of Amarillo, a ransomware virus in April encrypted the records-management software used by the Potter County Sheriff’s Office, locking the agency out of its inmate records, warrants, reports and other materials. “We lost everything we had in there,” said Sheriff Brian Thomas — at least the data that had been entered over the past 18 months. “We had to do everything by paper and pencil. We had to go back in and re-enter all of that stuff. We just finished that up about a week and a half ago.”

Sheriff Thomas said he never learned why his county was targeted. He believed it was a random attack. “I think it was just one of those deals where they send out 1,000 of them a day and they found a weak link and were able to get into our system,” he said. “Somebody clicked on an email link and it went poof.”

It was not known if the cyberattacks in Laredo, Potter County and other parts of Texas in recent months were related to the coordinated attack that began Friday.

The United States Conference of Mayors, which represents cities with populations of 30,000 or more, has said ransomware attacks on local governments are on the rise.

At least 170 city, county or state government systems have experienced an attack since 2013, with 22 of those attacks occurring in the first six months of 2019, according to the organization. At its annual meeting in June, the mayors’ conference adopted a resolution opposing paying ransoms in cybersecurity breaches, citing the organization’s “vested interest in de-incentivizing these attacks.”