RIO DE JANEIRO — For months, authorities in Brazil have sought access to digital data from WhatsApp to aid in criminal investigations. WhatsApp has repeatedly resisted the requests.

On Tuesday, the same clash erupted again, for the third time in less than a year. A Brazilian judge in a state criminal court in Duque de Caxias, in Rio de Janeiro, ordered a nationwide shutdown of WhatsApp after the popular messaging service, which is owned by Facebook, did not turn over user data requested by authorities as part of a criminal investigation. A few hours later, Brazil’s Supreme Court overturned the order.

Despite the brevity of the episode, the case is part of a broader debate worldwide about when law enforcement officials and governments should have access to the digital data kept by tech companies. Many of the companies, like Apple and Microsoft, have said they are unwilling to turn over such data to authorities because doing so would infringe on the privacy rights of their customers. But authorities have argued that they need the data for security reasons.

In Brazil, WhatsApp faced two previous shutdowns — one last December, and another in May — for not turning over digital information. Both of those bans were also quickly overturned on appeal by higher court judges. In March, a Facebook executive was briefly taken into custody for refusing to comply with similar orders to turn over information from WhatsApp.