Surveillance cameras deployed across the nation’s capital abruptly malfunctioned prior to President Trump’s inauguration last week, preventing police from recording video footage for several days leading up to his swearing-in and triggering reinstallation efforts across Washington, D.C., city officials said Friday.

The Metropolitan Police Department became aware of problems affecting four of the city’s camera sites on January 12, eight days prior to Mr. Trump’s inauguration, the Washington Post reported Friday. Technologists found that two forms of malicious software had infected video recorders at each of the four sites, spurring an investigation that subsequently identified dozens of other affected devices across the District, police officials told the Post.

The infections prevented police from using 123 of its 187 video recorders between Jan. 12 and Jan. 15, briefly curbing law enforcement’s ability to log footage captured by its network of surveillance cameras located in public places throughout the nation’s capital, the Post reported.

Public safety was never jeopardized as a result of the infections, Secret Service spokesman Brian Ebert told the newspaper.

Investigators resolved the problem by identifying each of the infected video recorders, then disconnecting those devices from the internet and purging them completely of software before restarting the system, Archana Vemulapalli, the city’s chief technology officer, told the Post.

More than a half-million people flocked the city’s streets less than a week after the malware was removed, taking into account Mr. Trump’s inauguration and the massively attended Women’s March protest held the day after.

Technologists determined the devices had been infected with two separate strains of ransomware, an increasingly popular and profitable type of malicious software recently attributed with sidelining city computer systems throughout the country, all the while causing upwards millions of dollars in monthly damages, according to the FBI.

In the event of ransomware infections, typically vulnerable computers are compromised in a manner that makes them inoperable until the victim either pays the perpetrator or obtains adequate technical advice. The FBI said it doesn’t recommend paying a ransom in response, but recently estimated that extortionists used the cyber-scheme to wring $1 billion out of victims in 2016.

The Los Angeles Community College District paid nearly $30,000 to an unidentified perpetrator earlier this month to recover from a campus-wide ransomware infection, and a study conducted last year by IBM Security determined that 70 percent of businesses affected by ransomware ended up making payment.

San Francisco’s Municipal Railway decided last year to let passengers ride for free while it tried to purge its ticket machines of ransomware instead of paying up. The incident was raised on Capitol Hill last month by Sen. Mark Warner, Virginia Democrat, who said he feared “grave and far reaching” repercussions would occur if the same sort of assault targeted Washington, D.C.

“These reports highlight how vulnerable our systems are to fast-proliferating ransomware threats,” Mr. Warner told The Washington Times upon being made aware of the latest infection. “The rush to connect ever more products, devices and systems to the internet has not advanced with an adequate focus on device or data security. While many ransomware attacks are opportunistic, with attackers scanning internet connections for insecure devices, incidents like these highlight how devastating a deliberate attack targeting critical infrastructure or sensitive security systems could be.”

The cyberattack suffered this month by the city’s surveillance system is under investigation, the Post reported.