The dispute over the territory of Western Sahara should be solved by consensus, Mauritania's leader said on a visit to Morocco.