SAN FRANCISCO — U.S. Magistrate Judge Paul Grewal is leaving the bench to take a position at Facebook Inc.

Grewal, who has served on the Northern District of California bench since 2010, will join the social-network company as its vice president and deputy general counsel of litigation in late June, overseeing global litigation for the company. Grewal and a Facebook spokesperson confirmed the move over email Thursday afternoon.