Kahlil Idriss said the man, identified only as Nicolas P., 33, was convicted Thursday in the city of Sale, near Rabat, in a case unrelated to the double murder.
A dual Swiss-Spanish citizen was among more than 20 people arrested after Danish student Louisa Vesterager Jespersen, 24, and 28-year-old Norwegian Maren Ueland were found beheaded on December 17 in the High Atlas mountains south of Marrakesh.
Nicolas P. was arrested in January for having had contact with the Swiss-Spanish national as well as compatriots with ties to Syria, Idriss said.
He was found guilty of "forming a terrorist group".
The lawyer said he has filed an appeal on the basis that his client had signed a police report in Arabic without having read it.
The accused told the court he had been paid by Switzerland's secret services for making contact with Swiss terror suspects.
Moroccan authorities allege the four main suspects in the hikers' murders were sympathisers of the Islamic State (Isis) group but not in direct contact with Isis members in Iraq or Syria.