Israel's Supreme Court has banned its intelligence agency from tracing the phone location of those infected with Covid-19, until new laws are passed.
The Shin Bet internal security service had been given emergency powers in March to use the technology.
Now, the court says legislation must be brought in for it to continue past 30 April.
It warned of a "slippery slope" of using the "extraordinary and harmful tools" against innocent citizens.
"The state's choice to use its preventative security service for monitoring those who wish it no harm, without their consent, raises great difficulties and a suitable alternative... must be found," the court said.
It also decided that if tracking laws are brought in, they should include a provision that journalists who become infected can apply for an exemption, in order to protect their sources.
The decision effectively closes the door on phone location tracking using emergency powers granted by the cabinet without parliamentary approval. A parliamentary oversight committee shut down a similar police operation last week.
The Association for Civil Rights in Israel, one of the groups which brought the court challenge, welcomed the decision, saying: "Israel must not be the only democracy operating its secret security service to monitor its citizens, even in the fight against the coronavirus."
Energy Minister Yuval Steinitz, however, said he was concerned by the court's decision, and that the operations had contributed to the effort to fight the outbreak.
The country has had just over 200 deaths from the virus in the outbreak, with around 15,000 cases.