In a surprise move late Sunday, Uber’s board of directors picked Dara Khosrowshahi, the CEO of online travel company Expedia, to take over the embattled ride-hailing company.

Assuming Khosrowshahi takes the top job, he will fill a spot that has been left vacant for more than two months after the departure of co-founder Travis Kalanick amid accusations of rampant sexism, mistreatment of employees and unethical practices at the company.

A 48-year-old Iranian American businessman, Khosrowshahi has served at the helm of Expedia since 2005, during which time the company expanded its global presence to 60 countries.

Khosrowshahi had been the dark horse of Uber’s CEO search, emerging as the leading contender only in the final moments — during a series of weekend meetings of Uber’s board, according to anonymous sources quoted by the New York Times, and after two candidates, Hewlett Packard Enterprise CEO Meg Whitman and General Electric Chairman Jeffrey Immelt, had publicly withdrawn from the contest.

Uber did not respond to a request for comment on the board’s selection Sunday night.

On paper, the differences between Kalanick and Khosrowshahi seem vast and numerous.

While Kalanick fought for months to remain on an advisory council to President Trump, despite criticism and calls for his departure from Silicon Valley peers and his employees, Khosrowshahi has been an outspoken critic of the Trump administration and its policies.

Earlier this year, Khosrowshahi ended an earnings call with investors by saying, “Hopefully we will all be alive to see the end of next year.” On the day Trump was inaugurated, Khosrowshahi shared an Expedia ad on social media encouraging people to broaden their understanding of the world through travel, a subtle knock against Trump’s antiglobalist policies.

“Dara is not a white man; as an immigrant from Iran, he can relate to a lot of the challenges that some underrepresented people at Uber may have been through,” said travel industry analyst Henry Harteveldt, president of Atmosphere Research Group. “Dara is not a tech bro, which is not to say he is a stodgy guy — he is not, but Dara is an adult. And he leads like one.”

Recruiting a new CEO had been fraught with infighting on the board, including a contentious lawsuit by early Uber investor Benchmark Capital against Kalanick.

Though Uber is valued at nearly $70 billion by its investors, continues to grow rapidly and is probably headed toward an initial public offering, the company remains unprofitable and has many critics.

ALSO

Its reputation has been marred by allegations of a toxic workplace culture for which many blame Kalanick. It has also been embroiled in lawsuits including an intellectual property dispute with Waymo, Google’s self-driving car business, and has several vacancies in leadership, including the jobs of chief financial officer and chief operating officer.

Even its real estate portfolio is in turmoil. The company is pulling out of its move into Oakland, looking to sell Uptown Station, the enormous former Sears building downtown that Uber bought two years ago, and remains so thoroughly disliked by the community there that Black Girls Code, an Oakland nonprofit, refused to accept a $125,000 donation from Uber.

All of these difficulties have weighed on the search. As Uber’s eight-person board narrowed the candidates down to three, one bowed out of the process. Immelt, who had just stepped down as CEO of GE, said on Twitter Sunday morning that he had “decided not to pursue a leadership position at Uber.”

Immelt had reportedly been Kalanick’s pick to take over his old position, which may have given pause to board members reluctant to allow Kalanick’s influence to continue unchecked.

Insiders and analysts had said the company could have benefited from having a female CEO.

For weeks, it has seemed the woman Uber’s board wanted for the job was Whitman, who had close ties to Benchmark.

But Whitman, 61, repeatedly denied interest in the job, saying she was committed to Hewlett Packard Enterprise. “Uber’s CEO will not be Meg Whitman,” she tweeted on July 27.

People who know Khosrowshahi described him as a competent leader with a strong commitment to diversity and a frank manner.

“He is calm, razor-smart, open and honest to a fault,” said Carl Shepherd, co-founder of vacation-rental site HomeAway, which Expedia bought for close to $4 billion in 2015. “If a man can fix the problems Travis created at Uber — and that’s a big if, because Travis dug quite a big hole — Dara is that man.”

“A big challenge for Uber is fixing its culture, getting employees who are still there to feel good about the company they work for, to feel pride in the company they work for,” Harteveldt said.

Today, Khosrowshahi serves as a board director at companies including Fanatics Inc. and the New York Times Co.

“He’s managed through transition,” said Jason Clampet, co-founder and editor in chief of travel website Skift. “He’s managed through turmoil, and he’s done a pretty good job of it.”