Al-Attiyah and co-driver Matthieu Baumel's winning margin was 7m55s over Sebastien Loeb and Daniel Elena, following a rally-long battle with the Peugeot crew.

The Toyota driver topped the opening 12km superspecial by 31 seconds, and was helped by Loeb getting a one-minute penalty for exceeding the speed limit by 2km/h after the prologue.

However, Loeb responded by dominating the subsequent 272.8km test, taking the lead from the Qatari.

Yet Al-Attiyah was fastest in the next three stages, all of which were shortened by rain and flooding, and eventually pulled ahead by 6m42s.

He entered the final day with that gap and managed to further extend it to 7m55s over Loeb, who had to settle for second as the top-placed Peugeot, as his teammate Carlos Sainz was only 10th.

Sainz had a troublesome event, as he first received a 50-hour penalty for, according to Peugeot a lack of communication with the organisers.

The penalty was revoked a day later and the Spaniard was sitting third overall before a mechanical problem ruled him out.

X-Raid Mini driver Kuba Przygonski ended up in third, followed by stablemate Nani Roma, who was fourth in his first event back with the team, and Vladimir Vasilyev (Mini).

Al-Attiyah's highest-placed teammate was Aron Domzala in sixth, nearly a minute off the pace. Former WRC star Mikko Hirvonen took seventh, followed by X-Raid teammates Bryce Menzies and Orlando Terranova.

Rally Morocco was Al-Attiyah's seventh win in 10 rounds in the 2017 FIA Cross-Country World Cup, which he clinched with a round still to spare.

Walkner wins motorcycle class

KTM's Matthias Walkner was victorious in the motorcycle category of the event, as Pablo Quintanilla clinched his second consecutive FIM Cross-Country title.

The final round of the championship started as a five-way fight between Quintanilla, Honda duo Kevin Benavides and Paulo Goncalves, as well as KTM's Sam Sunderland and Matthias Walkner.

The latter two had the best start to the event, leading the way with identical times in the prologue, but Quintanilla took over in the first proper stage.

The Chilean lost time in the following second stage, affected by flooding, as he got stuck in a river. While he was able to continue, Sunderland, who had the same issue, couldn't after he injured his ribs and the tank of his KTM becane flooded.

Yamaha's Adrien van Beveren was fastest in the stage with Walkner taking over the overall lead, ahead of Honda's Goncalves and Benavides.

It was the third Honda of Ricky Brabec leading the way in the subsequent run, beating Walkner by 10 seconds, who lost his overall lead to Quintanilla as the Chilean was given back 20 minutes for his woes in the previous stage.

However, organisers to decided to revoke the compensation the following day, again topped by van Beveren, gifting Walkner a comfortable seven-minute lead.

The Austrian extended his lead to 13m42s during the final day. However, in order to win the title, Walkner needed Quintanilla to finish outside the top seven, and the Husqvarna rider finished in exactly that position.

Walkner was followed by Benavides and Brabec, as the third Honda of Goncalves was forced to retire with a wrist injury.

KTM's Antoine Meo, who was fastest in the prologue before being given a six-minute penalty and dropping to 62nd, recovered to fourth, ahead of Sherco's Juan Pedrero and Adrien Metge.