The 475 suspects will be returned to their home states for “proper rehabilitation” before being sent back to their families, a Nigerian justice ministry statement said on Sunday.

Those detained were arrested on suspicion they belonged to Boko Haram or had concealed information about the group’s plans or fighters’ whereabouts.

“However, the Prosecution Counsel could not charge them with any offence due to lack of sufficient evidence against them. Therefore, the suspects were released,” the statement said.

The court proceedings in the town of Kainji, in central Niger State, was part of the second phase of an unprecedented mass trial of more than 1 600 suspects.

Some of the cases heard last week involved suspects held without trial since 2010.

Among those released was a young girl with a three-month-old baby from Borno State who was taken to a Boko Haram enclave by her brother and married off to his friend when she was 11. She was arrested in 2014 while trying to escape.

READ MORE: Nigerian officials abusing women, girls displaced by Boko Haram – HRW

The Kainji court sentenced 20 Boko Haram members to between two and 15 years in jail last week.

It also imposed a second 15-year sentence on Haruna Yahaya (35) who was involved in the 2014 kidnapping of more than 200 schoolgirls from the Chibok region .

Earlier in the week, he had been jailed for 15 years, but the court handed him an additional 15-year term on Friday, with the judge saying the two sentences would run consecutively.

In total, some 1 669 people have been processed in a string of mass hearings that began in October.

Most were men, but some women and children were also incarcerated. Nigeria was criticised by human rights groups for holding them for years without trial, or even contact with a lawyer.

READ MORE: 82 Chibok schoolgirls kidnapped by Boko Haram freed

After the first phase of the trial in October, 45 Boko Haram fighters were sentenced to between three and 31 years in jail, while about 500 people were discharged.

More than 20 000 people have been killed and two million forced to flee their homes in north-eastern Nigeria since Boko Haram launched an insurgency in 2009 aimed at creating an Islamic state.

Nigerian President Muhammadu Buhari recently said the era of Boko Haram violence “is gradually drawing to end”. However, the group continues to launch suicide attacks in the country’s northeast and its leader remains at large.