JERUSALEM — Prime Minister Benjamin Netanyahu was supposed to be facing trial this week on bribery, fraud and breach of trust charges.

Instead, he was shutting down the courts and ordering Israel’s internal security service to identify people who should be quarantined using data harvested from their phones.

Both of those extraordinary moves, announced in the dead of night on Sunday and Tuesday, were made in the name of combating the coronavirus. The court shutdown also had the effect of delaying Mr. Netanyahu’s corruption trial by two months.

Many Israelis have expressed admiration for the celerity and aggressiveness of Mr. Netanyahu’s response to the pandemic: Israel was ahead of the curve in shutting down travel to hot spots, ordering new arrivals into quarantine and closing down the public schools.