JERUSALEM (AP) — Israel’s parliament approved a law Wednesday granting the country’s internal security agency limited authority to use phone surveillance to track coronavirus cases as the country struggles to contain a second outbreak.

The Israeli government had authorized the Shin Bet to use the technology in March during the peak of the country’s coronavirus outbreak, despite public outcry over privacy concerns. But the country’s Supreme Court ordered the surveillance halted until the security agency’s permission was granted by law.

The Knesset, Israel’s parliament, voted 51-38 in favor of granting the Shin Bet power to use phone surveillance to retrace the steps of people infected with COVID-19 and identify others who came in contact with them in the previous two weeks. Those determined to have been in close proximity with an infected person will be ordered to self-quarantine for two weeks from the date of contact.

The law grants the Shin Bet permission to track cell phones for a three-week period on a case-by-case basis and only in instances in which other epidemiological tracking methods are insufficient in determining contact between a patient and other potentially infected persons.

But the law does grant the prime minister authority to give the Shin Bet additional powers if circumstances require. A ministerial team will evaluate the need of the surveillance, while taking into consideration the impact on individuals’ right to privacy.

Israel has seen a spike in confirmed coronavirus cases in recent weeks since the government began easing restrictions on movement in May. New daily cases of the novel coronavirus have exceeded 600 in the past week, with the total number of confirmed cases exceeding 26,000. At least 321 Israelis have died of the disease since the beginning of the pandemic in March, according to the Israeli Health Ministry.

Earlier this month, the head of the Shin Bet reportedly told Israeli Cabinet ministers that he opposed the continued use of his agency’s technology to track coronavirus cases.