Uber Technologies Inc. agreed to give about $245 million in stock to settle the high-stakes trade-secret theft lawsuit brought by Waymo, resolving a conflict that already cost the ride-hailing giant its top driverless car engineer and threatened to further embarrass the company.

That will give the Alphabet Inc. driverless-car unit 0.34 percent of Uber equity, Waymo said. Tony West, Uber’s general counsel, declined to comment on the settlement.

The court showdown captivated Silicon Valley during a year in which Uber weathered multiple scandals that drove co-founder Travis Kalanick out of his job as chief executive officer. Uber and Waymo are rivals in the nascent automated driving industry, which both companies believe to be worth hundreds of billions of dollars a year in revenue.

Waymo alleged that one of its senior engineers, Anthony Levandowski, hatched a plan in 2015 with Uber for him to steal more than 14,000 proprietary files, including the designs for lidar technology that helps driverless cars see their surroundings.

Dara Khosrowshahi, Uber’s CEO, said in a letter Friday his job is to set the course for the future of the company expressed regret for actions that led to the letter.

“To our friends at Alphabet: we are partners, you are an important investor in Uber, and we share a deep belief in the power of technology to change people’s lives for the better. Of course, we are also competitors. And while we won’t agree on everything going forward, we agree that Uber’s acquisition of Otto could and should have been handled differently.”

A spokesman for Waymo said the company “reached an agreement with Uber that we believe will protect Waymo’s intellectual property now and into the future. We are committed to working with Uber to make sure that each company develops its own technology.”

Uber bought Otto, the company Levandowski formed just before he quit Waymo in January 2016, in a $600 million stock deal. Levandowski became head of Uber’s self-driving project, but was demoted, and eventually fired, as the litigation heated up. Levandowski, who isn’t a defendant in the lawsuit, refused to answer questions from Waymo and turn over documents, citing his constitutional right against self-incrimination.

U.S. District Judge William Alsup ratcheted up the risk for Uber when he asked federal prosecutors in May to investigate Waymo’s claims. He said Waymo made a compelling showing that Levandowski absconded with its files and that Uber “knew or should have known” that when it brought him aboard.

Waymo was seeking as much as $1.86 billion in damages and a court order barring Uber from using the technology in dispute.

The case is Waymo LLC v. Uber Technologies Inc., 17-cv-00939, U.S. District Court, Northern District of California (San Francisco).