A Melrose Police detective’s laptop was infected with an email virus last Thursday, compelling the department to pay a Bitcoin ransom to regain control of its network, according to Police Chief Michael Lyle.

On Saturday morning, Lyle and Information Technology Director Jorge Pazos met a Bitcoin broker at a Panera Bread location in Brookline, where Pazos paid $489 in cash in exchange for a single Bitcoin.

“The chief had to double park, so I had to run in and make the buy,” Pazos told the Free Press.

Pazos then transferred the Bitcoin to the hackers via a mobile app, following instructions the hackers had left on the laptop. The department was back online by Saturday afternoon.

Bitcoin, a form of digital currency created and stored electronically, was invented in 2008.

“It’s evil, but it’s pretty ingenious,” Pazos said. “They come in, they encrypt your files, they don’t really steal anything — and yeah, they are holding you [to] ransom, but it’s a pretty low ransom. If they were asking for a million dollars, we never would have done it.”

The attack came in the form of an email sent to the entire department before 7 p.m. Thursday. A detective opened an attachment that set off the virus and encrypted all of the data on his laptop.

After the officer in charge alerted Pazos to the attack, Pazos shut down the department’s TriTech software for filing log entries and incident reports, preventing the virus from spreading.

While the TriTech data is backed up and could easily be recovered, some of the data on the detective’s laptop — mostly photographs — was not.

“That’s why we proceeded with buying the Bitcoin and trading for the encryption key,” Pazos said.

The Melrose Police did not lose any data, but officers were forced to put all log entries and incident reports in Microsoft Word documents until the problem was addressed, according to Lt. Mark DeCroteau.

They also had to book arrested parties on paper — “the old fashioned way,” DeCroteau said.

DeCroteau noted that the department was still able to access other data systems to search criminal history and find any outstanding warrants.

Pazos said the IT department has seen a recent uptick in emails containing this type of virus, and that he has sent out two warning emails to city employees in the past couple of months.

Similar incidents have occurred in Melrose in the past, he added, including two years ago in the engineering department, but the data was recovered and there was no need to pay a ransom.

“We don’t really do a lot of backing up of individual computers,” Pazos said. “We back up everything on the network. It’s another reason we tell people not to use their [laptop] computers, because we don’t always have an opportunity to back those up.”

Going forward, Pazos said he doesn’t plan to do much differently in terms of backing up data — though his department is always looking for better ways to protect the city from cyberattacks.

“This is a cat and mouse game,” he said. “For the most part, we did the things that we kind of needed to do on a regular basis, but there’s always a potential for these types of gaps.”

Even more important, he said, is continuing to press employees to proceed with caution.

The IT department emails users on a regular basis about potential threats, and the tech support team offers face-to-face education.

“We really want to focus on the user behavior and them having good hygiene,” Pazos said. “Which is what this was: bad hygiene.”