In the first case, the five men who got the longest terms were convicted of a bomb attack in a Shiite-populated village east of Manama in August last year.
The bomb exploded when a police bulldozer was clearing barricades that had been erected by protesters, the source said.
In the second trial, the same court handed out jail terms of between three and 15 years to 14 Shiites convicted of attacking police in Sitra, south of the capital.
The tiny Gulf state has been shaken by unrest since it quelled a month-long, Shiite-led uprising demanding reforms in 2011.
The Shiite-majority kingdom, connected to Saudi Arabia by a causeway, lies across the Gulf from Shiite Iran and is home to the US Fifth Fleet.
Despite the crackdown on the 2011 uprising, protesters frequently clash with police in Shiite villages outside the capital Manama.