With a spectacular late goal, Ivory Coast won in the last minute and advanced to the semi-finals.
After the game went into extra time, Oumar Diakite scored in added time, giving the home team a 120+3 minute victory.
Shortly after circling around the box and finding the back of the net, Diakite was dismissed to begin his raucous celebrations.
After encircling the referee, Hamari Traore of Mali followed him shortly after, and the officials were led off for their protection.
Ivory Coast carried on with their wild celebrations after the final whistle blew, securing their place in the AFCON semi-finals.
Similar to their performance against Senegal in the final 16, Les Elephants produced a thrilling display by leaving it late in both normal and extra time.
Due to two bookable offences in the first half, Odilon Kossounou was sent off. The first occurred when he gave up a penalty that Adama Traoré correctly missed.
The defender was substituted shortly before halftime, but Mali could not capitalise on their numerical advantage until Nene Dorgeles, an Ivorian midfielder, curled in what appeared to be the game-winning goal shortly after the 70th minute.
But there were more turns and turns, as there have been a lot throughout this AFCON.
After a goalmouth scramble, Simon Adingra of Brighton scored in the final minute of normal time with an opportunistic finish.
Just as penalties were about to be called, Oumar Niakite deflected Seko Fofana’s attempt for the winner.
After receiving a yellow card, Niakite took off his shirt to celebrate. As a result, tensions escalated and many Mali players surrounded referee Mohamed Adel.
With momentum now in their favour, the hosts will take on DR Congo in their semifinal matchup next week.