Mark Zuckerberg was a senior in high school at the elite Phillips Exeter Academy, toying around with an app that kept track of the songs preferred by its users, when a young lawyer took on a big job in Washington: selling the USA Patriot Act to Congress in the edgy and uncertain days after the attacks of Sept. 11, 2001.

Eighteen years later, Jennifer Newstead, 49, faces a task no less formidable. She was named Monday as Facebook’s general counsel, tasked with defending the technology giant, which is a prime target of global debates over digital security, individual privacy, hateful content and disinformation. The United Kingdom, the European Union and Australia are all taking steps to crack down on Facebook’s content, police illegal activity and impose liability on its management.

The announcement of Newstead’s move to Silicon Valley comes as federal regulators investigating Facebook for mishandling the personal information of its users consider how to hold Zuckerberg, the company’s 34-year-old chief executive, responsible for the lapses.

Before the technology wunderkind founded the social-networking site in 2004 and remade the way people put themselves online, Newstead — whom the company lifted from President Trump’s State Department — had a hand in transforming the government’s access to personal data, whether on the Internet or in telephone and financial records. Notably, the Patriot Act significantly expanded the use of so-called national security letters, a form of subpoena that law enforcement can issue to companies without court oversight.

Facebook has reported a spike in government requests for data, creating a dilemma for the company about how much information to hand over — a battle Newstead will have to litigate on the other side of the courtroom.

As chief deputy in the Office of Legal Policy in the fall of 2001, she was the “day-to-day manager of the Patriot Act in Congress,” John Yoo, a deputy assistant attorney general, would later write in his “Insider’s Account of the War on Terror.”

Together, the two lawyers — both graduates of Harvard College and Yale Law School, and both former clerks on the D.C. Circuit Court of Appeals and the U.S. Supreme Court — briefed Hill staff members on the constitutionality of the legislation, which gave the government vast new authority to wiretap, surveil and investigate terrorism suspects. Portions of the measure have since been declared unconstitutional. It was amended in 2015, as lawmakers curtailed some of the broad intelligence capabilities they had once granted to national security officials.

“She was a quick study and an effective advocate — she went from zero to sixty on terrorism in the days after 9/11,” Yoo wrote of Newstead.

Now, she will bring that legal acumen to Facebook.

"Jennifer is a seasoned leader whose global perspective and experience will help us fulfill our mission,” Sheryl Sandberg, the company’s chief operating officer, said in a news release.

A Facebook spokesman declined to comment on the lawyer’s role in crafting the Patriot Act and moving it through Congress. The State Department, where Newstead is currently a top legal adviser, also declined to comment.

Her pivot from Washington to Silicon Valley follows more than two decades of weaving between the public and private sectors. She has represented the government in its quest for new tools to fight terrorism as well as private companies in their encounters with government inquiries and regulatory enforcement problems.

Newstead was born at the Fort Dix military base in New Jersey, where her father was stationed during the Vietnam War. Her mother immigrated from Britain. After college and law school, she clerked for Laurence H. Silberman, a Ronald Reagan appointee to the D.C. Circuit Court, and then for Supreme Court Justice Stephen G. Breyer.

She joined the Justice Department in 2001 and left in May 2002, three months after a news release announcing her promotion to the role of principal deputy assistant attorney general praised her work “helping craft the new U.S.A. Patriot Act.”

Named an associate White House counsel, Newstead joined an office that included the likes of Brett M. Kavanaugh, who was confirmed to the Supreme Court last year. After about a year, she moved to the Office of Management and Budget, and then returned in 2005 to private practice at Davis Polk & Wardwell, a white-shoe firm based in Manhattan where she had worked as an associate from 1997 to 2001.

Trump tapped her to serve as the State Department’s top legal adviser in 2017. A White House release touted her “global practice representing clients in cross-border regulatory, enforcement and litigation matters.”

In October 2001, a single senator — Russell Feingold (D-Wis.) — voted against the Patriot Act. In December 2017, 11 senators — including presidential contenders Bernie Sanders (I-Vt.), Kamala D. Harris (D-Calif.), Elizabeth Warren (D-Mass.) and Kirsten Gillibrand (D-N.Y.) — opposed Newstead’s confirmation.

Her hearing before the Senate Foreign Relations Committee focused mainly on American military engagement overseas, and in particular on the civil war in Yemen. Sens. Todd C. Young (R-Ind.) and Christopher Murphy (D-Conn.) temporarily placed a hold on her confirmation to press the administration to take a firmer stand against the Saudi-led coalition’s blockade of Yemen.

In a prepared statement for the committee, Newstead said a lawyer “must be willing to speak hard truths and identify limits where law and circumstances require.”

She did not discuss the Patriot Act by name but described how she had worked, in the aftermath of the Sept. 11 attacks, “to develop legislation to modernize longstanding law enforcement tools to better equip our government to fight terrorism.”

Although Newstead’s experience at the Justice Department raises questions about her approach to data privacy, her time at State gives her unique insight into the dilemma facing social media companies as purveyors of news and images of searing conflict.

The problem became acute this week when the Sri Lankan government, fearing disinformation, blocked access to Facebook and other sites after Easter Sunday bombings killed more than 300 people. Last year, Facebook was criticized for temporarily removing posts that included an image of a starving Yemeni girl. (Facebook cited its policy on nude images of children but restored the posts.)

In a news release Monday, Secretary of State Mike Pompeo celebrated Newstead as the “first woman ever to head the State Department’s Office of the Legal Adviser.” He said she “exemplified the leadership qualities for which American diplomats are renowned the world over.” He added that she will be missed.

Newstead’s government experience is likely to come in handy for Facebook, as the social media giant faces intensifying federal scrutiny. In particular, her status as a veteran of Republican administrations could help smooth the company’s relationship with GOP officials who have accused Facebook of pro-liberal bias.

But a cozy relationship with Washington power brokers could also present fresh headaches for the technology titan.

Last fall, Facebook said it had “made mistakes” after a top executive appeared at Kavanaugh’s confirmation hearing in an apparent show of support for the judge, a longtime friend. Joel Kaplan, the company’s vice president of global public policy and another veteran of the George W. Bush White House, was seated two rows behind the nominee as he denied allegations of sexual assault.

Facebook was forced to issue a statement saying it was “grateful for all the feedback from our employees” and affirming, “Sexual assault is an issue society has turned a blind eye to for far too long — compounding every victim’s pain."

Kaplan and his wife later threw a party to celebrate Kavanaugh’s confirmation, according to Politico. The justice made an appearance.

Newstead has kept a lower profile. Unlike Kaplan, she has not been photographed at dramatic confrontations over the character of her former colleagues. Unlike Yoo, she has not written books about her role in the war against terrorism.

Even private correspondence that has leaked into public view scarcely includes her voice. In collections of emails exchanged during Bush’s first term — and procured during the bruising battle over Kavanaugh’s nomination — officials in the White House Counsel’s Office and the Justice Department discussed everything from surveillance powers to the scandal surrounding the energy company Enron to judicial appointments. But Newstead does not appear as an author of the messages.

In 2002, when she was still at the Justice Department, she was copied on an email advising administration officials working on a judicial appointment that any “talkers we put out” had to be “reviewed and signed off by Brett Kavanaugh.”

Emails from October 2001, directly from Kavanaugh to Newstead, were released last year as part of a Freedom of Information Act request by the Electronic Privacy Information Center.

But the content of the emails was withheld, deemed unsuitable for the public.

More from Morning Mix:

More than a thousand arrested in ‘Extinction Rebellion’ protests against climate change

A state senator said nurses ‘probably play cards’ at work. Facing mass outrage, she’s apologized.

Two rival politicians accused each other of using drugs. The result was a showdown at a urinalysis lab.

Police thought they found a killer 41 years after her roommate’s death. Now it’s too late.