MALABO, Equatorial Guinea - Guinea won the drawing of lots for a spot in the African Cup of Nations quarterfinals on Thursday by choosing a green ball with the No. 2 printed on a piece of paper on the inside.

Amara Dabo, an official with Guinea's sports ministry, picked the winning ball out of a bowl at the start of an organizing committee meeting at a hotel in Malabo. That meant Guinea finished second in Group D and eliminated Mali. Guinea will next face Ghana on Sunday in the quarterfinals.

The two teams were forced to draw lots after finishing all three of their group matches 1-1. The Ivory Coast won the group by beating Cameroon 1-0 on Wednesday and will next face Algeria.

Before Dabo showed the officials in the room which number he'd drawn, he let a big smile run across his face. A short time later, Dabo was in the lobby of the hotel jumping for joy while talking on the phone.

The draw took place with Dabo and a representative from the Malian federation seated at the head of a U-shaped table, separated by African football confederation president Issa Hayatou and general secretary Hicham El Amrani.

"We have no other choice," Hayatou said before the balls were placed in the bowl.

The two representatives reached their hands into the bowl at the same time and picked a ball. Dabo was the first to open his.

Drawing of lots is rare, but not unprecedented. But many believe there must be a better way to judge which team remains in the tournament and which is sent home with the exact same record.

"We don't have the power to change anything," Mali team spokesman Modibo Traore said. "CAF have to change ... but it is not a first for CAF. It's a first for our association."

Guinea is one of the three worst affected countries by the Ebola outbreak. Many in the team have said that just qualifying for the tournament was a victory.

"The whole of Africa has come together to fight the Ebola epidemic, including our brothers in Mali," Guinea sports minister Domani Dore said. "Today is a very important day for our country. It shows when you work hard, and work together, good things can happen."