(CNN) -- Defending champions Egypt will play Ghana in the Africa Cup of Nations final after thrashing bitter rivals Algeria 4-0 in a semifinal that saw their opponents finish with just eight men.
The game was evenly poised until Rafik Halliche brought down Emad Moteab in the area eight minutes before the break.
Halliche was sent off and Hosni Abd Rabou converted the spot-kick to put Egypt on their way for a possible third successive title.
Mohamed Zidan added a classy second after 65 minutes before Nadir Belhadj then saw red for a horror challenge on Ahmed El Mohamady five minutes later.
Mohamed Abdelshafy grabbed his first goal for Egypt nine minutes from the end, but there was still time for Algeria goalkeeper Faouzi Chaouchi to pick up a second yellow card -- and for Mohamed Gedo to make it 4-0 in stoppage time.
The result proved sweet revenge for Egypt who missed out on a World Cup spot when they were beaten by Algeria in a play-off.
There was controversy surrounding Egypt's opener. The penalty decision appeared clear-cut but Hosni converted with the help of a stuttering run-up which incensed Chaouchi, who made a vehement protest to the referee and was lucky not to be sent off himself.
Zidan doubled the advantage after turning Belhadj inside out before dispatching a left-footed shot into the far corner.
Belhadj's evening got worse after he launched a two-footed lunge on El Mohamady and was rightly given his marching orders.
Abdelshafy came off the bench to add a third with a neat finish from an acute angle.
Chaouchi was then dismissed two minutes from time as he swung his foot at Gedo, who moments later finished past substitute keeper Mohamed Zemmamouche for the fourth.
Meanwhile, earlier in the day, Ghana edged past near-neighbors Nigeria 1-0 in a match which produced much less drama.
Asamoah Gyan scored the only goal midway through the first half when a Kwadwo Asamoah corner caught out the napping Super Eagles defence and the Rennes striker applied the finishing touch.
It was one-way traffic thereafter as wasteful finishing from Nigeria, coupled with some dogged defending and solid goalkeeping from Richard Kingston, helped the four-time former winners seal a place in the final for the first time since 1992.