A defence lawyer in Bahrain says an 11-year-old boy accused of taking part in anti-government protests has been freed from prison pending his trial.

The lawyer, Mohsen al-Alawi, says the sixth-grade student was allowed to return home Monday after spending a month behind bars, where he took his final school exams.

The boy, Ali Hasan, faces charges of joining an illegal gathering and other claims related to the ongoing unrest in the troubled Gulf nation.

The boy is among the youngest suspects detained in crackdowns on protests led by Bahrain's Shia majority, which seeks a greater political voice from the ruling Sunni dynasty.

The boy's next court session is set for June 20.

More than 50 people have died in Bahrain's upheavals since February 2011.