Even by the standards of one of the poorest corners of the world, northern Nigeria has more than its fair share of child beggars. Linger on any street corner and, sooner or later, a child dressed in rags will be staring up at you, tugging gently at your sleeve and pricking sharply at your conscience.<br/> These, though, are no ordinary street children. Many are pupils at local madrassas, or Islamic boarding schools, which send them out to beg for their keep every morning, afternoon and evening. That a school can treat its children in this way beggars belief. Yet across Nigeria's Muslim north, millions are enrolled in madrassas that are more like Dickensian poor houses than places of education. Visiting one in the city of Maiduguri last year, I saw children as young as five heading out with their begging bowls, returning five hours later to sleep in filthy, earth-floored shacks.<br/> If that sounds bad, though, it pales alongside the horrors uncovered during a recent series of police raids on Nigerian madrassas. In the latest one, which took place last week in the city of Ibadan, police found more than 500 traumatised boys and young men, many of them bearing scars from torture. Pupils spoke of being beaten, starved and even sexually abused in a makeshift punishment cell equipped with manacles on the walls.<br/> It was a similar story at a madrassa in nearby Daura – home town of Nigeria's president, Muhammadu Buhari – where more than 300 men and boys were found, some of whom claimed to have been raped. The students were kept "in the most debasing and inhuman conditions in the name of teaching them the Quran," said a police spokesman, adding that the teachers would now face "the full wrath of the law".<br/> If the case does reach court, however, it won't simply be the teachers on trial but Nigeria's whole system of madrassa schools, many of which fall far short of the standards of genuine faith-based schools.<br/> In Nigeria, the madrassas offer a cheap alternative to modern western education, which some Muslims see as a Christian system imposed during colonial rule. Boys – and it is only boys enrolled – learn how to recite the Quran by rote, and get rudimentary teaching in numeracy and literacy. In practice, many madrassas have become de facto paupers' homes for children whose parents cannot afford to look after them. In the last decade, their numbers have swollen, thanks to the Boko Haram insurgency, which has claimed nearly 30,000 lives and created countless orphans.<br/> As the recent raids showed, some madrassas also double as rehab centres, catering to those who have fallen foul of Nigeria's very own opioid crisis. Abuse of Tramadol, a cheap prescription painkiller, has become endemic among the nation's youth. With hospital-run rehab clinics massively overstretched, the madrassas offer their own primitive alternative, keeping addicts as prisoners until they are clean. Given the torture and rape accounts that have emerged from the recent raids, such "therapy" is clearly wide open to abuse. True, only a minority of madrassas are involved in rehab work. But what really worries critics of the system is the tradition of organised begging, which makes madrassa pupils easy recruits for groups such as Boko Haram. <br/> Strictly speaking, the begging is part of a tradition of Islamic almsgiving. The idea is that the madrassa pupils – known as almajiri, or "travellers seeking religious knowledge" – are supported by the community around them. But today there are simply far too many almajiri for the public to maintain that fraternal generosity. While there are no definitive figures, the Nigerian government estimates that there may be anything up to eight million almajiris – one in 25 of Nigeria's 200m population. In cities like Maiduguri, that means a lot of outstretched palms – and a lot of locals who now see them as just another group of pesky street urchins. At the madrassa that I visited, pupils would frequently come home with bruises and black eyes from people fed up of being badgered for money.<br/> It is no surprise, therefore, that some almajiri are tempted into crime to earn their keep. And in northern Nigeria, that doesn't just mean robbing and stealing. Armed with 1,000 naira (about $4), a local Boko Haram sympathiser can easily persuade an almajiri to act as a spy or plant a bomb – if only to wreak revenge on a community that no longer seems to care for them. Indeed, many of Boko Haram's key followers are ex-almajiri, including Abu Bakar Shekau, the commander who kidnapped 276 schoolgirls from the town of Chibok in 2014.<br/> With the Boko Haram conflict now moving into its second decade, the Nigerian government has belatedly pledged action to reform the madrassa system. In June, before the recent abuse scandal broke, Mr Buhari pledged to shut down rogue operators and create a proper registration system. So too, though, did his predecessor, Goodluck Jonathan, who promised hundreds of new schools to stop almajiri becoming "cannon fodder" for terrorists. Of the 150 of those schools built, only a handful are currently in use. Yet even if madrassas were scrapped altogether in Nigeria – which some would support – there is the question of what to replace them with. Despite being oil-rich, Nigeria's history of kleptocratic government means its state-run secular schools are mostly failing too, staffed by underpaid, under-trained teachers and plagued by strikes. Many poorer parents, not just in the Muslim north, simply choose not to bother with school at all. Unless state education improves dramatically, it is hard to see madrassas losing their grip on the bottom end of the schooling market.<br/> As in Pakistan, where madrassas are likewise often linked to radicalism, there has also been talk of modernising their curriculum, which often has little to say about tolerance or secular values. Yet Mr Buhari – a Muslim himself – is very wary of offending the religious establishment. So too are western aid agencies, despite the billions of dollars they have spent on dealing with the Boko Haram crisis. While many aid workers put madrassas at the very heart of the problem, fear of being seen as anti-Islamic stops them speaking out.<br/> Instead, the madrassas could continue to be a problem that Nigeria finds easier to ignore – just like the outstretched palms of those child beggars in Maiduguri. <em>Colin Freeman is a journalist and author of Kidnapped: Life as a Somali Pirate Hostage </em>