but time was not on their side as Libya held on.
Knowing that they needed to first and foremost take care of their own result, Libya started well and got off to the perfect start, opening the scoring in the fifth minute.
Newcastle-bound Papiss Cisse then swung a shot over the bar, before Ali Samala went close to scoring for Libya; his header being kept out by Khadim N'Diaye.
Camara was making a real nuisance of himself and his cross then found Pape Malickou Diakhate, but his header was well saved by Abod.
Niang himself then blazed over from distance, with Jamal Mohamed doing the same at the other end, before Senegal's Souleymane Camara saw his close-range hit brilliantly kept out by Samir Abod.
A second Libyan goal did arrive, though,Robert Griffin III Redskins Jersey, and when it did, with six minutes remaining, it was a memorable one.
That was the last meaningful action of the first half and the last real incident until the hour mark,Ray Rice Youth Jersey, which saw Ahmed Zuway's strike blocked by Kader Mangane as Libya hunted a second,Randall Cobb Packers Jersey.Camara and Shibani: Battle for ball Related articles Stevanovic sacked by Ghana Al-Ain 'in driving seat' for Gyan Zambia climb up world rankings
Zuway cushioned a long ball into the path of the onrushing Ihaab and he spectacularly volleyed it into the bottom corner,Tracy Porter Jersey.
They and Senegal - who equalised on the night through Deme N'Diaye - are both now out, with much-fancied Senegal ending without picking up a single point.
Marcos Paqueta's men needed to win their Group A game and hope Equatorial Guinea would beat Zambia and, although Ihaab's double ensured they kept their side of the bargain, Zambia's 1-0 win ensured it was nothing more than a proud farewell for Libya.
That could have come when Mohamed El Moghrabi's corner found Abdalah Al Sherif, only for him to miss the target,Aaron Rodgers Jersey,
before Mangane got in the way of another Zuway effort,Ahmad Bradshaw Giants Jersey,.
A jinking run from Admed Saad created some space and, after he played a reverse pass, Ihaab was on hand to do the rest from just inside the area.
The lead was shortlived, though, with N'Diaye getting ahead of his front-post marker to nod home Mamadou Niang's ninth-minute corner.
Al Busaifi Ihaab scored twice as Libya beat Senegal 2-1 but failed to make the Africa Cup of Nations knockout stages.
Cisse tried his best to get Senegal level for a second time just after, but time was not on their side as Libya held on.