European food-ordering firm Just Eat Takeaway.com has agreed to buy US peer Grubhub in an all-stock deal that, if completed, would create the world's largest food delivery company outside China. 

The deal would create "a company built around four of the world's largest profit pools in food delivery: the US, the UK, the Netherlands and Germany," the companies said in a joint statement. 

For Grubhub, the deal offers an escape from the competition concerns that plagued its talks with the Uber Eats division of ride-hailing firm Uber Technologies. 

Uber approached Chicago-based Grubhub in May for an all-stock deal that fell apart this week. 

In a statement, Uber said the food delivery industry needs consolidation, but "that doesn't mean we are interested in doing any deal, at any price, with any player." 

Media reports about the Uber offer prompted Just Eat Takeaway to reach out with its own offer, Grubhub CEO Matt Maloney told Reuters in a phone interview. 

Just Eat only recently acquired Takeaway, in January, for $7.8 billion. 

Maloney has known Just Eat Takeaway's billionaire chief executive Jitse Groen since 2007, and both companies have similar models based around being a marketplace for customers to find restaurants and order from them, Maloney said. 

The European firm presented an offer "at a price that made the decision very easy," Maloney said. The deal also provides Grubhub "financial strength and flexibility." 

Experts say consolidation is long overdue in the U.S. restaurant delivery sector, where demand is surging, especially as many people stay home to combat the spread of the novel coronavirus. 

Just Eat Takeaway said it expects to close the deal in the first quarter of 2021, pending shareholder and regulatory approval. 

Analysts said a deal between Grubhub and Just Eat Takeaway should win easy approval from US competition enforcers.

The combined company will be headquartered in Amsterdam. 

They said in a presentation that Just Eat Takeaway had 2019 revenues of €1.5 billion, compared with Grubhub's €1.2 billion. 

In a trading update, the companies said that order growth was up 41% across the companies' main markets in April and May, as the coronavirus outbreak led to a surge in use of online food services. 

Groen founded Takeaway in 2000 while still a student and oversaw its growth through a series of acquisitions, including a 2018 deal to buy the German operations of rival Delivery Hero. 

Groen owns a 10.29% stake in Just Eat Takeaway ahead of the Grubhub deal.