Announcement comes as ride-hailing service fights allegations of sexism and racism that led to ousting of founder Travis Kalanick

Uber has chosen Dara Khosrowshahi, the chief executive of travel company Expedia, to be its new boss, ending a contentious search that has been marred by boardroom spats and leaks.

The announcement, made on Sunday, comes as the ride-hailing service fights allegations of sexism and racism that led to the ousting of its founder, Travis Kalanick.

Khosrowshahi, a 48-year-old Iranian American who has led Expedia for 12 years, was a surprise appointment who beat Meg Whitman, the chief executive of HP Enterprise, and Jeff Immelt, the former CEO of General Electric, for the job.

The Expedia CEO has been critical of Donald Trump, tweeting in the wake of his Charlottesville remarks: “I keep waiting for the moment when our Prez will rise to the expectations of his office and he fails, repeatedly.”

Earlier on Sunday, Immelt said via Twitter that he had “decided not to pursue a leadership position at Uber”, while expressing “immense respect” for the cab-hailing company and its founders.

Jeff Immelt (@JeffImmelt) I have decided not to pursue a leadership position at Uber. I have immense respect for the company & founders - Travis, Garrett and Ryan.

Immelt stepped down as CEO at GE this year after 16 years running the industrial conglomerate. The 61-year-old did not say why he had pulled out, but the New York Times said that he would not likely have received enough votes from the Uber board to edge ahead of rival candidates.

Uber’s eight-member board met over the weekend to decide on a new CEO, the New York Times said. The shortlist of candidates had narrowed to three people – Whitman, Immelt and Khosrowshahi.

Whitman, 61, had previously said she planned to stay at HP and described speculation over her departure from the IT services group as a “distraction”. She tweeted last week: “We have a lot of work still to do at HPE.”

Meg Whitman (@MegWhitman) (3/3) We have a lot of work still to do at HPE and I am not going anywhere. Uber's CEO will not be Meg Whitman.

Uber had been searching for an experienced executive to fill the vacuum left at the top by the departure of co-founder Kalanick in June, and to restore confidence in the business following months of chaos.

Khosrowshahi will have to reform the company’s workplace culture following accusations of sexual discrimination and harassment, recruit new executives including a chief financial officer and chief operating officer, and deal with numerous legal wrangles. They include an intellectual property dispute with Waymo, Google’s self-driving car spinoff.

Kalanick resigned in June following pressure from investors, just one week after taking an indefinite leave of absence. That leave of absence was not enough for a group of investors who own more than a quarter of Uber’s stock and account for about 40% of voting shares, giving them enough leverage to force out Kalanick when they demanded that he quite the role.

The San Francisco-based company had asked the former US attorney general Eric Holder to conduct an investigation into the company’s workplace culture. The long list of recommendations for reform included reviewing and reducing Kalanick’s role in the company. Uber is reeling from allegations of workplace discrimination and sexual harassment, revelations of a secret programme to evade law enforcement, lawsuits and other legal challenges brought by drivers, bans on its UberPop service of unlicensed drivers in several countries and a string of departures of high-level executives.

Facebook Twitter Pinterest Travis Kalanick resigned as Uber chief executive in June amid mounting shareholder pressure. Photograph: Will Oliver/EPA

The pressure on Uber and Kalanick became critical after a former employee published a blog post in February describing a workplace rife with gender discrimination and sexual harassment.

The venture capitalist David Bonderman resigned from Uber’s board of directors in June after making a sexist comment at the all-staff meeting where the Holder report’s recommendations were presented. At least 20 employees were fired over incidents of harassment, retaliation, discrimination and bullying, dozens more were disciplined and a number of complaints remain under investigation by Holder’s law firm, Perkins Coie.

Kalanick came under fire for his leadership style when Bloomberg released a video of him berating an Uber driver after the driver had complained about the difficulty making a living with Uber’s falling pay rates. Kalanick apologised for his behaviour in a statement that conceded he needed “leadership help”, and he announced his intention to hire a chief operating officer to assist him in the management of the company.

A number of senior executives have quit the company recently, including president Jeff Jones, who said he left because working at Uber was incompatible with his values; senior vice-president of engineering Amit Singhal; head of policy and communications Rachel Whetstone, vice-president of product and growth Ed Baker and head of finance Gautam Gupta.