The recent killings of three Europeans in the self-declared republic of Somaliland have been blamed by the president on global terror networks.
Riyale wants his country to be recognised
President Dahir Riyale Kahin asked for help from the international community, which does not recognise Somaliland's independence from Somalia.
He was speaking to the BBC Somali service following Thursday's decision to expel all illegal imigrants.
Two British teachers and an Italian nun have been killed this month.
In 1991, the former British protectorate of Somaliland declared unilateral independence from Somalia, which is deeply divided by clan fighting.
Somaliland had been more peaceful than the rest of Somalia.
Interior Minister Ishmail Aden Osman blamed the killings on "other Somalis".
"They are destablising our security and the peace that the country has," he told the the BBC Focus on Africa programme.
These "other Somalis" will be expelled, along with Ethiopians and Kenyans, he said.
Ten people have now been arrested in connection with Monday's shooting of British teachers Richard and Enid Eyeington.
Two more have been arrested over the killing of renowned Italian aid worker Annalena Tonelli earlier this month.
Because Somaliland is not recognised internationally, most Somalilanders travel on Somali passports, says Abdisalam Mohamed, from the BBC Somali service.
But President Riyale said this would not be a problem.
"In Somaliland, we know each other, we know who is a Somalilander," he said.
The BBC reporter says this means anyone who is not one of the clans originally from Somaliland is likely to be expelled.