The Syrian citizen was found guilty of attempted murder and attempted robbery at the fast-food restaurant in the centre of the city in the canton of Bern, the ATS news agency reported.
A 30-year-old man and a 46-year-old woman were left paralyzed by the attack in the bilingual (German-French) city, also known as Bienne.
The defendant had entered the restaurant, located on the Rue de Nidau, a pedestrian street, after it closed and fired several rounds before fleeing without taking anything.
He was arrested without resistance the following day at his home.
The Bernese Jura-Seeland court suspended the prison term so the convicted man can obtain treatment from a psychiatric treatment centre, where he will be interned.