As far as the climate goes, it is better to visit the south – or at least the desert routes – outside midsummer, when for most of the day it’s far too hot for casual exploration, especially if you’re dependent on public transport. But July and August, the hottest months, can be wonderful on the coast, while in the mountains there are no set rules.
Spring, which comes late by European standards (around April to May), is perhaps the best overall time, with a summer climate in the south and in the mountains, as well as on the Mediterranean and Atlantic coasts. Winter can be perfect by day in the south, though desert nights can get very cold – a major consideration if you’re staying in the cheaper hotels, which rarely have heating. If you’re planning to hike in the mountains, it’s best to keep to the months from April to October unless you have some experience of snow conditions.
Islamic religious calendar and its related festivals will have the most seasonal effect on your travel. The most important factor is Ramadan, the month of daytime fasting; this can be a problem for transport, and especially hiking, though the festive evenings do much to compensate.