RIO DE JANEIRO — WhatsApp, a messaging service owned by Facebook, was shut down in Brazil on Monday after a court order from a judge who is seeking user data from the service for a criminal investigation.

Judge Marcel Maia Montalvão ordered telecom companies operating in Brazil to suspend WhatsApp nationwide for 72 hours. As of just after midday Monday, Brazilians said they could not use the popular messaging service.

The shutdown is the latest twist in a case that has embroiled WhatsApp in legal trouble. The case, which is under seal, involves an organized crime and drug trafficking investigation in the court in Lagarto, in the northeastern state of Sergipe. The court has been seeking data from WhatsApp to aid in the investigation. Diego Dzodan, a Facebook executive, was briefly taken into custody in March for refusing to comply with orders to turn over WhatsApp information in the case.

The judge who ordered WhatsApp’s shutdown on Monday is the same one who ordered Mr. Dzodan’s arrest. Mr. Dzodan was released after one night when a higher court judge said the arrest was “an extreme measure.”