Morocco scored all five of their penalties to advance to a home Women's Africa Cup of Nations final ©Getty Images

Hosts Morocco beat defending champions Nigeria on penalties to set up a Women’s Africa Cup of Nations final versus South Africa.

A goalless first half at the Stade Prince Moulay Abdallah in Rabat was followed by a fiery second with two goals and Nigeria receiving two red cards.

Halimatu Ayinde was the first to be ordered to leave the pitch following a dangerous tackle.

The red card did not seem to matter much to the 11-time champions when a clearance deflected off of Morocco’s Yasmin Katie Mrabet and into her own net in the 62nd minute, giving Nigeria the lead.

However, their resilience was broken eight minutes later with Sanaâ Mssoudy equalising for the hosts.

Nigeria’s Rasheedat Ajibade was then sent off to put her nation in an even more precarious position.

Nine-woman Nigeria remained undeterred and held on to the 1-1 draw for the remaining 19 minutes and extra time to take the match to a penalty shootout.

Ifeoma Onumonu’s penalty miss proved to be decisive as Morocco progressed to their first final at the tournament 5-4.

They are set to play South Africa, who are also bidding to win the trophy for the first time, following their 1-0 win against Zambia at the Stade Mohammed V in Casablanca.

The match was beckoning for extra time before Linda Motlhalo scored a 94th-minute penalty to fire South Africa to the final.

The third-place match is set to be played on Friday (July 22) in Casablanca with the final following the next day in Rabat.

These four teams have all qualified for the 2023 FIFA Women's World Cup in Australia and New Zealand by reaching the semi-finals.