"They literally saw the light at the end of the tunnel in the early hours [of] today," the source said.

The prisoners were fasting on Monday to protest against what they called "mistreatment and repression" by prison officials.

'Apology letter'
 
Mahtade said the men had left a letter complaining of what they saw as the "injustices" of the Moroccan legal system.

"We had tried every way to end this injustice and we knocked on all doors for that without result. The only way left for us is to do that [breakout]. We hope that you will understand," the letter said.

"We apologise for the disturbance we have caused. That was the only solution." 

Human rights groups say that Morocco's prisons are overcrowded and most of the 60,000 prisoners complain of lack of decent food and access to healthcare.

Detainees found to have links to anti-government Muslim groups want to be given "political prisoner status" which would allow them better conditions.