Idris was sentenced by a Daura Road Upper Sharia Court in Kaduna on Wednesday after he pleaded guilty to a two-count charge of criminal conspiracy and theft.
The judge, Alhaji Aminu Jumare, did not give Idris, a resident of Ungwan Sunuji in Kaduna, any option of fine.
He said the sentence was to serve as a deterrent to other criminals.
Earlier, the Prosecutor, Shehu Abdullahi, had told the court that Mohammed Lawal of No. 19, Charranchi road, Tudun Wada, Kaduna, had reported the case to the Metro Police Area Command in Kaduna on March 30.
Abdullahi said that on the same date at about 5.15 a.m., the complainant was on his way to Yusuf Dan Tsoho Memorial Hospital when the convict and two others attacked him.
The prosecutor further said that they used long knives to force the complainant to release his cell phone valued at N72,000 as well as stole his motorcycle and N3,000 cash.
He said the convict was arrested while trying to flee the scene although his accomplices escaped.
The prosecutor said the cell phone and motorcycle were recovered from the convict.
Abdullahi said that the offences contravened sections 117, 141 and 232 of the Penal Code.