Host nation Qatar crashed out of their own World Cup on Friday after they were beaten 3-1 by Senegal and Ecuador held the Netherlands to a draw.
The Gulf state, which has spent an estimated $200 billion to stage football's global showpiece, become just the second World Cup hosts in history after South Africa in 2010 to bow out in the group stage.
Senegal scored either side of half-time through Boulaye Dia and Famara Diedhiou before Qatar substitute Mohammed Muntari replied in the 78th minute to set up a dramatic finale.
The African champions' substitute Bamba Dieng scored six minutes later to put the result beyond doubt and lift Senegal, who opened with a 2-0 loss to the Netherlands, right back into contention in Group A.
Qatar's second successive defeat left the Asian champions relying on Ecuador beating the Dutch a few hours later, but the match ended 1-1 to seal the Qataris' fate.
"We would like to say we're very sorry to the supporters, to the country," said Tarek Salman, who was a second-half substitute.
"We have made them feel bad about losing two games in a row in the World Cup."
"It feels very bad to be out of the World Cup. I think today we played a good game and in the big games small details change the game," he said.
"We made two mistakes, they scored two goals but for some minutes of the game we played better than them, we scored a goal. We have to learn from our mistakes."
Qatar had made a nervy start to the tournament in a 2-0 defeat to Ecuador and they again looked tentative against Senegal.
The Qataris dropped their goalkeeper Saad Al Sheeb to the bench after his shaky performance in the opener.
His replacement Meshaal Barsham did not inspire much confidence in the early stages, flapping at a corner as Senegal pushed for the opening goal.
Ismaila Sarr and Nampalys Mendy had already missed scoring chances for Senegal by then, and Idrissa Gana Gueye and Youssouf Sabaly squandered more as the first half wore on.
- Qatar dumped out -
Qatar spent most of the opening 45 minutes on the back foot but a rare break forward saw Akram Afif incensed not to be awarded a penalty after he was bundled over by Sarr.
Senegal looked like they would head into half-time without managing to break down Qatar's resistance, only for the hosts to gift them a goal in the 41st minute.
Qatari defender Boualem Khoukhi fluffed a clearance to leave Dia to pounce on the loose ball and fire it past Barsham.
Senegal doubled their lead almost immediately after the break when Diedhiou glanced home a header at the near post from a corner.
Qatar began to show much more attacking ambition from two goals down and Afif was involved in everything.
Almoez Ali forced a fingertip save out of Senegal goalkeeper Edouard Mendy before the Chelsea man again rescued the Africans from Ismail Mohamad's effort.
Mendy was rooted to his line when Muntari pulled one back for Qatar, powerfully heading home Mohamad's cross to haul the hosts back into it.
The goal lifted the crowd and sent Qatar surging forward in search of another, but Dieng nipped the revival in the bud in the 84th minute when he swept the ball home for Senegal's third.
Abdelkarim Hassan then lashed a free-kick just wide of the post as Qatar tried to hit back but Senegal held firm to see out the win.