PORT-GENTIL: Mohamed Salah's thumping early free-kick gave Egypt a 1-0 win against Ghana on Wednesday as they sealed their place in the quarter-finals of the Africa Cup of Nations.
The record seven-time winners of the competition came into the game in Port-Gentil only needing a draw to be certain of going through but the victory at a barely half-full stadium allowed them to leapfrog already-qualified Ghana and finish on top of Group D.
Hector Cuper's solid side that has not conceded a goal yet in Gabon will now stay in the port city of Port-Gentil for a last-eight tie against Herve Renard's Morocco on Sunday evening.
"It's difficult to come out and play for a draw. We came out to win from the off. I am not as happy with the performance as I would like but I think given who we were up against I have to be satisfied," said Cuper.
"We will have a bit of a breather now, rest a bit, and then start thinking about Morocco. Our ambition is very high and we are going to fight to keep progressing and reach the final stages."
Ghana, meanwhile, must now up sticks to Oyem in the north of the country for a quarter-final against an impressive DR Congo side, also on Sunday.
"I don't think it matters," said Ghana coach Avram Grant. "I said before the two teams we could have played were good and it would be a tough game. "I hope the pitch there will be better, but I'm not sure about this."
If going to Oyem does not bother the Black Stars and Grant too much given the state of the surface in Port-Gentil, an injury to skipper Asamoah Gyan might.
Gyan, making his 99th international appearance, was looking to score his 50th goal for his country, but he went down with what looked like a groin injury towards the end of the first half and eventually came off.
Jordan Ayew replaced him, but Grant looked ashen-faced at the prospect of being without his captain for the quarter-final as Ghana look to win a fifth Cup of Nations and a first since 1982.
"It's not looking so good but Gyan is a very strong boy," said Grant when asked about the extent of the problem. "We will need to wait and see. We will have a scan and then we will know better."
Egypt went in front in the 11th minute thanks to a moment of inspiration from their star man Salah, the Roma player smashing home a free-kick on his left foot from 23 yards that left Razak Brimah in the Ghana goal rooted.
Once again the shocking surface made flowing football almost impossible, and chances were few and far between.
Ghana did press in the second half but only truly tested Egypt's 44-year-old goalkeeper Essam El Hadary twice.
First he spooned away a powerful long-range strike by Emmanuel Agyemang Badu midway through the second period, and then he flew high to his right to save from Jordan Ayew in the 90th minute.
In the night's other game, Mali, needing to win to maintain hope of staying alive, were held to a 1-1 draw by already-eliminated Uganda in tricky conditions in Oyem.
On a pitch left sodden by torrential rain, Uganda went in front 20 minutes from time thanks to Standard Liege forward Faruku Miya's brilliant strike.
It was Uganda's first goal on their return to the tournament after a 39-year absence, but they could not get a consolation win.
Instead, Mali were level three minutes later, the impressive Yves Bissouma rifling in a free-kick from fully 30 yards.
The group stage over, there is now a two-day break before the first two quarter-finals on Saturday.
Burkina Faso will face Tunisia in the capital Libreville in the first of those, before a mouthwatering showdown between Senegal and Cameroon in Franceville.