(CNN) Algeria was crowned Africa Cup of Nations champion for only the second time in its history, edging past Senegal 1-0 thanks to Baghdad Bounedjah's early deflected goal.

After going behind, Senegal dominated for the remainder of the match but was unable to find an equalizing goal.

Midway through the second half, it looked as though Senegal had been handed a lifeline after referee Alioum Alioum awarded a penalty for handball.

However, after being advised by the Video Assistant Referee (VAR) to review the incident on the pitch side monitor, Alioum overturned his original decision.

It was yet more heartbreak for Senegal, which is still yet to win the greatest prize in African football.

But it will be the manner of this defeat that will hurt the most. Algeria's goal came from its one and only shot of the game and few would argue that Senegal was the better side for the other 88 minutes of the match.

Baghdad Bounedjah's shot deflected off Salif Sane and into the goal.

Less than two minutes in -- 79 seconds to be exact -- you got the sense this was just going to be Algeria's night, after the Fennec Foxes took the lead in bizarrely fortuitous circumstances.

Bounedjah silkily spun his defender and latched onto Riyad Mahrez's through ball, cutting inside onto his right foot and firing at goal from range.

Senegal center-back Salif Sané got across to make a block and appeared to have done enough, but the ball looped high into the Cairo night -- almost comically high -- and somehow kissed the underside of the crossbar and nestled into net.

Midfielder Badou Ndiaye extended his arms in the direction of his goalkeeper Alfred Gomis, inquiring as to why he made no attempt to get back and prevent the goal.

Presumably, like thousands of others in the stadium, he thought the ball must have been going behind for a corner.

Once in a generation

It was the perfect start for the Algeria fans who had traveled to Egypt in their thousands for this once-in-a-generation chance at making history.

Not since 1990 had the Fennec Foxes made it to the AFCON final, beating Nigeria 1-0 on home soil in front of 105,000 fans.

Algerian players celebrate with their fans after winning the 2019 Africa Cup of Nations.

The Algerian government had reportedly subsidized more than 5,000 plane tickets for Algeria supporters to make the four-hour flight to the Egyptian capital.

However, hundreds of fans with legitimate tickets -- including local Egyptians as well as Algerians -- were reportedly refused entry and left to wander the perimeter of the stadium, trying to find a way in after being told by officials that some sections were already full.

After Algeria's bright start -- Bounedjah almost made it 2-0 just moments later -- Senegal grew into the final and was by a considerable distance the better team for the remainder of the half.

But despite their dominance, the Lions of Teranga were unable to produce any clear-cut chances, largely due to Algeria's consistent tactical fouls that prevented Senegal finding any sort of rhythm.

The closest they came to opening the scoring was M'Baye Niang's sharp turn and long-range volley that whistled inches over Rais M'Bolhi's crossbar.

Led by Liverpool star Sadio Mané, Senegal was not willing to simply let this opportunity pass it by. Having never previously won the Africa Cup of Nations and only once making it to the final, these players knew they were on the brink of immortality.

Algerian players pray as they celebrate after winning the 2019 Africa Cup of Nations.

This final had been billed as Mané vs. Mahrez but so far the Premier League duo had been upstaged by their less illustrious teammates.

Senegalese youngster Ismaïla Sarr, a skillful winger at Stade Rennais and reportedly on the radar of both Arsenal and Watford, shone the brightest in the first half and was a constant threat down the right.

VAR controversy

In the semifinal against Tunisia, Senegal was on the right end of a controversial call that saw VAR overturn a decision to award their opponents a penalty in extra time.

As the final entered the second half, Senegal found itself in Tunisia's shoes as referee Alioum awarded it a penalty after Adlène Guedioura was adjudged to have handled in the area.

It seemed harsh as the time; Sarr's cross was fired from close range at Guedioura who had both arms behind his back. Alioum briefly consulted the pitch side monitor and overturned his original decision.

Though Senegal's players were perplexed at the time, in hindsight they will have few complaints.

As the final whistle got ever nearer, Aliou Cisse's side continued to press for an equalizer as Algeria sunk further and further back towards its goalkeeper.

Senegal coach Aliou Cisse applauds the traveling fans after the defeat.

Mane's sharp turn and shot brought a brilliant, lunging block from Aissa Mandi, before Niang blazed a shot high and wide of an open goal after rounding M'Bolhi.

Captain of the last Senegal side to reach the AFCON final in 2002, Cisse felt a familiar sinking feeling as Alioum blew the whistle for full time.

Algeria's player ran in the direction of the thousands of fans congregated behind the goal they had been defending resolutely for the last 45 minutes.

For those who traveled, for those back in Algeria and the communities around the world, these players will forever have their place in history.