This is the so-called pirates prison, a cream-coloured fortress, officially opened in November 2010 after a $1.5m (£950,000) refurbishment funded by the UN, to contain the pirates convicted of hijacking at sea off the Horn of Africa.
Although the number of pirate attacks has dropped to their lowest level since 2008, experts say the problem has not gone away. More than 100 attempted hijackings off the coast of east Africa have been foiled so far this year, and dozens of pirates captured – raising the question of what to do with them. None of the countries in the region have been prepared to take responsibility for bandits captured at sea.
Step up the breakaway enclave of Somaliland, which declared independence from Somalia in 1991 but is not officially recognised, and volunteered its territory in an attempt to enhance its international standing.
The prison holds 313 prisoners, including 17 pirates convicted in the Seychelles and flown to Hargeisa in March. Finding countries willing to prosecute the pirates has also been difficult. Seychelles changed its laws last year to allow pirates captured anywhere beyond its territorial waters to be put on trial, although it has turned down some requests.
The deal to transfer the 17 from Seychelles to Somaliland was signed in London between the leaders of the two territories in February. President James Michel of the Seychelles and President Ahmed Mohamed Silanyo of Somaliland said the agreement was an important step towards combatting piracy.
Inside the Hargeisa prison the atmosphere is relaxedut several of the prisoners complain they have been unjustly convicted.
"There were six of us in the boat, fishing," said Ahmed Khalif, 21, wearing a bright orange T-shirt. "We could see the lights of Mogadishu in the distance. We were arrested and taken to the Seychelles. At the trial, we didn't have lawyers and we didn't know the language." Khalif was sentenced to 10 years in jail.
Abdi Gadir, who was jailed for 24 years for the same crime, complained about the discrepancy in sentences.
Mawlid Ahmed, also jailed for 10 years, said the men did not have a chance to appeal against the convictions.
The prison commander, Omer Said Ali, echoed their concerns. "I don't know the particular points of the case or whether they are telling the truth," he said, "but they do have a right to appeal and it is unfair that they have not had the chance to do so."
A British barrister who observed a trial of pirates in the Seychelles last year has raised questions about the legal process. Tim Moloney QC said: "Whilst every effort was made by the parties and the trial judge to ensure that the proceedings were fair, there was a marked inequality of resources between the prosecution and defence which was capable of producing injustice. All five defendants were represented by a single lawyer. He had no instructions from the alleged pirates as to their defence to the charges and was simply testing the prosecution case."
Moloney pointed out that one of the five defendants claimed he was forced into taking part in piracy after being held hostage following an earlier raid.
"With one lawyer representing all the defendants, such a defence simply could not emerge," he said.
Even the military admits that the truth can be difficult to establish. Captain Jeremy Hill, commander of the American frigate USS Taylor, part of the Nato counter-piracy mission, said this year it was hard to distinguish between legitimate fishermen and pirates.
But with the new Somali government intent on joining Nato and international navies in cracking down on piracy, which is said to have cost the world economy more than $6.6bn in 2011, little is likely to change for the convicted pirates in Hargeisa.
The prisoners say they had requested to be transferred to Hargeisa mainly so they could be closer to their families in Mogadishu. However, none of them have yet received a family visit.
"We have not seen our families," said one prisoner. "The food here is not good. We get rice, tomatoes and only a little bit of meat. In Seychelles the food was better."
Mark Tran in Hargeisa