SPARED the violence that has ravaged southern Somalia for two decades, the breakaway Somaliland and Puntland regions are investing in education to lure youngsters away from extremism and piracy.

The self-proclaimed Republic of Somaliland hopes to prove it can build a stable, independent state as the international community has not recognised its autonomy since it split away from Somalia in 1991.

Semi-autonomous Puntland to the east - created in 1998 and now boasting its own political institutions and administration - is striving to keep its youth from joining Islamist extremist or pirate groups.

"Several generations have been lost, first under the (Somalia ex-president Mohamed Siad) Barre regime and then during the civil war," Puntland's president, Abdirahman Mohamud Farole, recently told an EU delegation.

The European Union, Somalia's biggest donor, contributes 85 million euros ($110 million) a year to the education sector in the whole of Somalia, including the two breakaway regions.

"We're against radical Islamism," Farole said.

Somalia's Al Qaeda-linked Shebab insurgents, under military pressure in the centre and south of the country, are reportedly trying to establish bases in Puntland, where the area's first pirate gangs emerged in 1998.

Zamzam Abdi Adan, Somaliland's education minister, estimated that only 50 to 55 percent of children in the region attend school.

"A nation can only be strong when it has human resources," Adan, a former teacher and Somaliland's only woman minister, told AFP. "We're trying to build solid human resources."

"We try to convince parents to send their children to school," said Adan, who in 2011 made primary education free and started to integrate teachers - previously paid by school fees - into the civil service.

This year the state will allocate 10 per cent of its budget to education.

Neighbouring Puntland plans to allocate 3.5 per cent of its budget to education this year, and 7 per cent in 2013.

"Education is the only way of counterbalancing extremism in Somalia. It's important to... provide a future" for young people," said Puntland's Education Minister Abdi Farah Said Juxa.

"Without education there is no hope," he said, adding that the other options young people face are piracy and other criminal activities.

EU education support "helps prevent a situation where young people with no qualifications get involved in extremist activities," said Isabel Faria de Almeida, who heads the EU's Education and Economic Development unit for Somalia.

The program also aims to get more girls into school, particularly into secondary school, where there are fewer girls despite an increase in overall enrollment.

Despite all their efforts and support from the EU, which pays some teachers' salaries on top of other support, the two regions are facing a huge challenge.

"Classes are full to overflowing and there aren't enough tables," explained Nassir Jam Bulale, the headmaster of the Fadumo Bihi school in Hargeisa, the capital of Somaliland, where four children squash onto a bench intended for two.

For colleague Ali Ahmed Balayah, one of the problems is low pay for state school teachers who earn around $100 dollars a month.

Once they get some experience, many of them flock to private schools, where they can earn up to three times more.

Puntland's Education Minister says that teacher training is a priority in his region.

"We need more classrooms, more teachers... more water, more electricity, more everything," his Somaliland counterpart said.