LONDON — Citing a “specific threat to Westerners,” the British government issued a warning on Sunday for any of its citizens living in Somaliland to flee the breakaway territory that lies between Ethiopia and the Gulf of Aden, on the northern tip of the Horn of Africa.

The notice came only days after Britain and other European nations issued urgent warnings to their citizens to leave the Libyan city of Benghazi, 2,500 miles northwest of Somaliland, because of what Britain described as “a specific, imminent threat to Westerners.”

A person who has been briefed on the new British warning said that a terrorist organization, most likely the Shabab, had threatened to kidnap foreigners in Hargeisa, the capital of Somaliland. As the Shabab fighters have been routed from parts of Somalia by African Union forces, many have moved north, to Somaliland and the semiautonomous Puntland region of northeastern Somalia, Western intelligence officials have said.

The Foreign Office in London linked its Benghazi warning on Thursday to the French military intervention against Islamic militant rebels in Mali. Its advisory then said there was a risk of retaliatory attacks against Western interests in the region in the wake of the French campaign in Mali and the attack on a remote gas plant in Algeria, described by some of those claiming to be its masterminds as a response to events in Mali.