A Bahrain court sentenced five people to life in prison on Tuesday for plotting "terrorist and hostile acts" with Iran, which bombarded the Gulf kingdom during the Middle East war.
Another 25 people were jailed for up to 10 years for sharing images of Iranian attacks and expressing support for them, the public prosecution said.
The High Criminal Court sentenced two Afghans and three Bahrainis to life for colluding with Iran's Revolutionary Guards to monitor and photograph vital facilities.
A fourth Bahraini was acquitted, the public prosecution said, adding that it may appeal the verdict.
"The Public Prosecution affirms that the crime of communicating with hostile foreign entities against the Kingdom of Bahrain is considered one of the most serious crimes affecting national security," the statement said.
The other 25 were jailed for "supporting and endorsing" the attacks and filming and sharing prohibited images, a separate statement said.
Tuesday's sentences come a day after Bahrain revoked the citizenship of 69 people who "supported hostile Iranian acts".