A Brazilian judge has released a jailed Facebook executive.

Facebook’s FB vice president of Latin America, Diego Dzodan, was released on Wednesday, the world’s largest social network confirmed to Fortune. A judge in the Brazilian state of Sergipe overturned an order on Tuesday that prompted his detention, saying that Dzodan could not be arrested because he’s not currently under a criminal investigation.

“Diego’s detention was an extreme, disproportionate measure, and we are pleased to see the court in Sergipe issue an injunction ordering his release,” a Facebook spokesman told Fortune. “Arresting people with no connection to a pending law enforcement investigation is a capricious step and we are concerned about the effects for people of Brazil and innovation in the country.”

Dzodan was detained on Tuesday following a court order that allowed local police to hold him for questioning. He was forced to stay in the jail overnight until his release on Wednesday morning.

Get Data Sheet, Fortune’s technology newsletter.

The detention is part of a broader case between Facebook-owned messaging service WhatsApp and an investigation into alleged drug-trafficking ring. Although many of the case’s details are unclear, as part of their investigation, Brazilian officials have sought communications over WhatsApp between people allegedly involved in drug trafficking.

According to a Reuters report on Tuesday, officials requested from Facebook last year WhatsApp messages that may relate to the case. Because the messaging platform uses end-to-end encryption, it effectively hides messages from the outside world, including investigators. Not even WhatsApp has access to those communications, frustrating law enforcement and prompting courts to up the ante. In December, after repeated requests on Facebook, WhatsApp was temporarily shut down across Brazil. Facebook CEO Mark Zuckerberg called the temporary shut down “a sad day for Brazil.” He added in a statement at the time that his company is dedicated to user privacy.

After that effort failed, a judge recently fined Facebook 1 million reais ($250,000) to compel Facebook to provide WhatsApp messages to law enforcement. After the fine didn’t work, Dzodan was detained.

For its part, Facebook has said that WhatsApp and its own operation have been actively working with law enforcement in Brazil as part of the ongoing investigation. Still, the company has said it does not have the key to decrypt the messages and provide them to law enforcement.

The issue is part of a broader battle between technology companies and law enforcement agencies over the proper balance between privacy and justice. Apple’s recent row with the FBI over whether or not it should be forced to help the agency unlock the iPhone owned by San Bernardino attacker Syed Farook has shone a bright light on the issue. Apple has said that its chief priority is user privacy and fears that helping law enforcement open a single iPhone could prompt similar requests in the future.

For more about Facebook and WhatsApp in Brazil, read: Facebook Exec Jailed in Brazil as Court Seeks WhatsApp Data

The FBI, along with other prominent law enforcement agencies around the world, have argued that the idea of privacy, while justified in some respects, can hinder opportunities for bringing justice to cases. Services like WhatsApp and Apple’s AAPL Messages, authorities argue, create an issue of “going dark,” a term coined by the FBI and Justice Department over the last couple of years to describe how terrorists and criminals could hide from law enforcement by using encrypted technologies.

“The ‘going dark’ problem is a very real threat to law enforcement’s mission to protect public safety and ensure that criminals are caught and held accountable,’’ said U.S. Attorney General Loretta Lynch at the RSA cybersecurity conference in San Francisco on Tuesday. ”We owe it to the victims and to the public, whose safety we must protect, to ensure we have done everything under the law to fully investigate terrorist attacks and criminal activity on American soil.’’

However, Lynch added that ultimately, a resolution to the issue, which FBI Director James Comey has called the “hardest question” he’s ever witnessed in government, is for companies and law enforcement to work together.

Despite Dzodan’s detention, Facebook seems willing to do just that and work with Brazil.

“We remain willing to address questions Brazilian authorities may have,” the Facebook spokesman said.

Sergipe authorities did not immediately respond to a request for comment.