Been a while since I was in North Africa, Algiers isn't somewhere I'd go back to in a hurry, the south is a different story, but I'm not sure of the safety aspect of going down that way. Also Tamanrasset is a long way south!
Morocco is good if you can deal with the hustlers, Marrakesh is a definite to see if you are in the area, Rabat, bit of a let down,unless it's changed, it's very much 'government' city, don't bother trying to find "Ricks" in Casablanca, it doesn't exist. Essaouira on the coast is pleasant, if you can stand the aggravation Fez is a must if just to see the leather tanning. Some nice old towns and Roman ruins in the north at Volubilus, Chefchaouen interesting for a day trip. Main thing about Morocco is to be very aware of pickpockets, especially young children in Jemaa el-Fnaa sqaure in Marrakech
As for Spain and Portugal, I enjoyed Portugal more, didn't like Barcelona at all, although when you get out into the country it's a different story, but as others have said ymmv.
,