Uber Technologies Inc. agreed to buy Postmates Inc. for $2.65 billion to expand in food delivery after the coronavirus pandemic cratered demand for ride-hailing, its main business, and an earlier attempt to acquire Grubhub foundered.

The all-stock deal is a modest outcome for Postmates, once a pioneer of the gig economy that was outmaneuvered by deep-pocketed competitors. It had been valued at $2.4 billion in an investment last year, a person with knowledge of the matter said at the time.

Uber estimates that it will issue about 84 million shares of common stock for 100 percent of the fully diluted equity of Postmates, the company said in a statement announcing the deal Monday.

“Postmates is highly complementary to Uber Eats, with differentiated geographic focus areas and customer demographics, and Postmates’ strong relationships with small- and medium-sized restaurants, particularly local favorites that draw customers to the Postmates brand,” Uber said in the statement.

Pierre-Dimitri Gore-Coty, the head of Uber’s food-delivery business, is expected to oversee the combined operation, a person with knowledge of the plan said Sunday night. Under their agreement, Postmates co-founder Bastian Lehmann and his team will stay on to manage the Postmates service, said another person, both of whom asked not to be identified discussing a private deal.

In its statement, Uber said it plans to keep the Postmates app running separately, supported by a more efficient, combined merchant and delivery network.

Since the start of the pandemic, Uber has cut more than a quarter of its staff and exited or pared back some businesses, such as electric bikes and financial services, so it could focus on core areas: ride-hailing and food delivery. Global rides plummeted 70 percent, CEO Dara Khosrowshahi said in June. Uber Eats has been a bright spot for the company as stay-at-home orders and restaurant closures have prompted more customers to order in.

Uber sees advantages of combining with Postmates beyond just meal delivery. Postmates has also been an early pioneer in delivery-as-a-service, complementing Uber’s efforts in shuttling groceries, essentials and other goods, the company said. Restaurants and merchants will benefit from tools and technology to connect with a bigger consumer base, according to the statement.

“Platforms like ours can power much more than just food delivery—they can be a hugely important part of local commerce and communities, all the more important during crises like COVID-19,” Khosrowshahi said in the statement. He noted that Uber Eats bookings in the second quarter are up more than 100 percent from a year earlier.

Uber’s proposed acquisition of Grubhub fell through last month when European rival Just Eat Takeaway.com NV bought it instead for $7.3 billion. Uber’s bid for Grubhub, one of the larger players in the U.S. food delivery market, was likely to have raised antitrust concerns, according to industry analysts. The two together would have controlled more than half the U.S. market.

An acquisition of Postmates is less likely to raise regulatory scrutiny because it wouldn’t change much in the competitive environment. Postmates, a distant fourth, would give Uber a firm lead over Grubhub, but the combined company would still trail SoftBank-backed DoorDash Inc., the nationwide leader. Postmates would strengthen Uber’s position in Los Angeles and the American Southwest, two markets where the brand is strongest.

Uber executives have been vocal for months about wanting to drive consolidation in the food delivery market, though. Postmates and Uber have allied before. The two companies sued California last year, alleging a state law that took effect this year designed to give gig workers unemployment protections is unconstitutional.

The transaction is expected to close in the first quarter of 2021, pending regulatory approval, Uber said.