Paul Grewal, the legal leader who helped Facebook weather its Cambridge Analytica scandal, has joined cryptocurrency platform Coinbase.

Grewal is stepping into the role of chief legal officer for the San Francisco-based fintech company after more than four years as Facebook's vice president and deputy general counsel. In May 2016, Grewal left his post as a magistrate judge for the U.S. District Court of the Northern District of California to join the social media giant.

In a blog post Wednesday, Coinbase Chief Operating Officer Emilie Choi wrote that when she asked Grewal why he wanted to take the position, he said, "I came to understand the vision for an open financial system for the world. And I got to see just how talented and committed the entire Coinbase team is in making that vision a reality. I decided then and there that I just have to be a part of this."

In his last couple years at Facebook, Grewal served as the front man for the company's efforts to restore public trust after Facebook gave Cambridge Analytica permission to access millions of users' data without their authorization.

On his San Jose bench, Grewal oversaw several Big Tech intellectual property battles, including Apple v. Samsung and Oracle v. Google.

As a judge, Grewal drew attention for his refusal to sign off on certain law enforcement requests for digital surveillance, and for ordering a lawyer who made a sexist comment to make a donation to a women's legal nonprofit.

A representative for Facebook said the company wishes Grewal well.