The military transport plane slammed into a mountainside in bad weather in southern Morocco [AFP]

A military transport plane slammed into a mountainside in bad weather in southern Morocco on Tuesday, killing all 80 people on board, hospital and military sources said.

King Mohammed VI announced three days of national mourning following the crash, one of the deadliest in the country's history.

The army said 78 people were killed on the spot after the Hercules C-130 crashed on the edge of the Sahara desert in Morocco's worst military aviation disaster.

A hospital source later told AFP that two injured who had been rushed to hospital had died of their wounds.

The plane crashed into a mountain northeast of Guelmim, located about 830km south of the capital Rabat, the army said in a statement.

Most of those onboard the aircraft were soldiers flying from Laayoune in Western Sahara to the coastal city of Agadir. But the army said civilians, including family members, were also on the flight.

"His Majesty the King ... and chief of the royal armed forces decrees three days of national mourning, starting on Tuesday, and the national flag will be lowered," the state-run MAP news agency announced.

An official also said the king had sent a message of condolence to the families of the victims.

Bad weather

The army statement blamed the accident on "bad weather conditions".

"Above all, it was the fog and bad weather conditions that are believed to be behind this accident. But for the moment, we don't have enough information," an interior ministry official said.

The plane slammed into a mountain around 10km from Guelmin, known as the gateway to the Sahara desert.

A provincial official said the plane had been preparing to land at the local military airport at Guelmin when "a huge pall of smoke came from the mountain". He said the plane had hit the well known mountain of Sayyert.

The bodies of several victims have been recovered from the mountainside and taken to the military hospital at Guelmin, the army said in the statement.

The US-made Lockheed C-130 Hercules is a turbo-prop military transport plane in use in dozens of countries around the world.

"This is a military plane that is used for the transport of troops, but also of their families. It is widely used in the Sahara," the interior ministry official said.

Tuesday's crash was the country's worst air disaster involving a military aircraft. In December 2001, a twin-engined plane used by the paramilitary police crashed in southern Morocco with at least five people on board.

Source: Agencies