RIYADH, Aug 21 (Reuters) - A Saudi Arabian court has sentenced 18 men to prison terms of 10 months to 25 years for their part in a series of militant attacks against government and foreign targets between 2003-06, state media reported late on Wednesday.

The men were part of a group of 50 on trial at the same time, of whom 30 have already been sentenced to jail and one to death.

Those sentenced on Wednesday were found guilty of crimes including giving information on foreign residential compounds to attackers, sheltering wanted militant suspects, financing militants and possessing illegal arms.

The conservative Islamic kingdom and U.S. ally has detained thousands of its citizens and sentenced hundreds of them to jail after a campaign of bombings and attacks last decade by an al Qaeda group that killed hundreds of people.

Riyadh's concerns about Islamist militants have grown more acute over the past two years as the conflicts in Syria and Iraq have attracted more of its own citizens to travel to those countries in order to join groups fighting in the name of jihad.

In February, King Abdullah decreed long prison terms for those who travelled overseas to fight or who gave material or moral support to groups officially labelled as extremist, inluding al Qaeda, Syria's Nusra Front and Islamic State.

On Tuesday, the kingdom's Grand Mufti, Sheikh Abdulaziz Al al-Sheikh, described al Qaeda and Islamic State and the ideology they represent as Islam's foremost enemy.