A Saudi Arabian accused also received the death sentence from the special court in Riyadh, the Saudi Press Agency reported yesterday.
Those jailed included five from the African nation of Chad, a Nigerian, a Yemeni and a Palestinian, along with Saudis, the agency said.
It did not say when the offences occurred but the accused were charged with opening fire at a Khaldiya district apartment block in the holy city of Mecca.
It said at the time that several suspects including Chadians, an Egyptian and a Saudi were arrested.
More From This Section
At their trial in Riyadh, the accused were also charged with training "at Al-Qaeda camps", planning to kidnap and kill VIPs, and other offences, the Saudi Press Agency said.
They can appeal the court's decision within 30 days.
Authorities in 2011 established specialised tribunals to try Saudis and foreigners accused of belonging to Al-Qaeda or of involvement in deadly attacks in the kingdom from 2003-2006.
Since late September Saudi Arabia and other Arab states have taken part in or given support to US-led coalition air strikes against militants of the Islamic State group in Syria.
Saudi King Abdullah has said that extremism "has nothing to do with Islam.