IS has claimed a series of bombings and shootings against Shias and security forces in the Sunni-majority kingdom
Saudi Arabia said on Monday it has arrested 17 people from three cells linked to the Islamic State (IS) group which planned to attack military and other facilities.
The interior ministry said 16 men and one woman were in custody. They are mostly Saudis but include one Yemeni, an Egyptian and a Palestinian.
They are the latest arrests connected with IS in Saudi Arabia.
Since late 2014, IS has claimed a series of bombings and shootings against Shia in the Sunni-majority kingdom, as well as the security forces.
Dozens of people have been killed, largely in Eastern Province, which is home to most of the country's Shia whom IS consider to be heretics.
A double attack hit a Shia mosque in Saudi Arabia’s Eastern Province back in January, with at least four people confirmed dead.
At least 18 people were also injured in the attack, which is home to large oil fields but is economically deprived.
"Months-long efforts culminated in the foiling of a terrorist plot that was to be carried out by a network made up of three cluster cells connected to IS," the ministry said in a statement to the official Saudi Press Agency.
"They targeted security officials and security, economic and military establishments and citizens in different locations."
The ministry said suspects wanted to attach a bomb to the car of a defence ministry employee in Riyadh.
They also targeted security students whom they planned to bomb with a remote-controlled device at a gate.
Police also disrupted the delivery of two suicide vests and separately prevented a suicide attack by a suspect who had monitored "religious sites" in al-Ahsa region, which has a substantial Shia community.
Attacks were planned to take place over successive days earlier this year.
The interior ministry added that, according to preliminary investigation, the suspects gave two suicide vests, training and automatic weapons to the bombers who attacked al-Rida mosque in Mahasen, al-Ahsa, on 29 January.
The Saudi bomber killed four people during Friday prayers at the mosque before worshippers disarmed and tied up his Egyptian accomplice who had fired on them.
Also in January, the suspects blew up the car of a soldier in Riyadh's Aziziyah neighbourhood, the ministry said.
IS leader Abu Bakr al-Baghdadi has called for attacks against Saudi Arabia, which belongs to the US-led coalition bombing the militants in Syria and Iraq.
In August, police said they shot dead a would-be suicide bomber targeting a mosque in the Shia-dominated Gulf coast district of Qatif.
Earlier that same month, police arrested a Saudi and a Syrian on their way to bomb a restaurant in the same area after training by IS, the interior ministry said.
Three separate suicide attacks took place throughout the kingdom on 4 July.
A Pakistani resident blew himself up near the US consulate in the Red Sea city of Jeddah, wounding two policemen.
Another blast occurred at a Shia mosque in Qatif, leaving the body parts of three people.
And near Islam's second holiest site, the Prophet's Mosque in Medina, four people died in the third suicide blast.
No group claimed responsibility, but CIA director John Brennan said those bombings bore the "hallmark" of IS.
Authorities arrested 19 people, including 12 Pakistanis, after the July attacks.