A Brazilian judge ordered the release of a Facebook executive, a day after he was arrested as part of a dispute involving WhatsApp.

Police in São Paulo questioned Facebook's VP for Latin America Diego Dzodan on Tuesday, and he remained in jail overnight.

A court had ordered Facebook to provide data from WhatsApp, a messaging app it owns, in connection with a criminal investigation into drug trafficking.

Authorities in Sergipe said they needed Facebook's help in a case where the suspects used Facebook Messenger and WhatsApp to communicate and plan their crimes.

According to the authorities, the judge issued the order three times and started fining Facebook 50,000 reals ($12,600) daily for noncompliance two months ago. Last month, the fine increased to 1 million reals ($253,000) per day. A warrant was issued for Dzodan on February 7.

Judge Ruy Pinheiro of Sergipe overturned the lower court's arrest warrant on Wednesday.

The judge ruled that Dzodan could not be arrested because he is not being investigated in the case, calling the move "illegal coercion."

Dzodan wrote on his Facebook page Wednesday evening that he was released and is ready to head back to work.

"I am back at my desk and wanted to thank you all for the immense show of support received during the last 24 hours," he wrote. "My inbox was flooded with warm messages from all over the world -- each of your notes made a big difference and I took them to my heart."

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

Facebook (FB) bought WhatsApp for $19 billion two years ago. Because WhatsApp encrypts information that passes through its platform and does not keep that information on a central server, it's harder for it to hand over data requested by authorities.

In the case in Brazil, WhatsApp says it's impossible to give data because of the strength of its encryption, and because the data is kept only on a person's device after it is delivered.

-- CNNMoney's Hope King contributed reporting to this story.