By Barry Malone
NAIROBI (Reuters) - Five hundred years ago, an Imam who ruled much of what is now Somalia, led a daring invasion of Christian Ethiopia, looting monasteries, burning down churches and slaying all who resisted.
Centuries on, memories of Imam Ahmad Gragn still haunt both countries, and echoes of that long and bloody history still ripple across the Horn of Africa region which considers Somalia the greatest threat to its stability.
Back then, the Ethiopians were beleaguered as the invaders occupied some two-thirds of the country. Help eventually came in the form of 400 Portuguese musketeers, who sailed into Massawa port and embarked on a six-day march to the front.
Gragn had his backers too. Reinforcements from Arabia soon rolled in alongside a gift from the Ottoman Empire: 900 of its famously hardened musket experts. The war lasted over a decade.
Fast forward to the present day, and with Ethiopian troops deploying over the border again last month to fight Islamist rebels linked to al Qaeda, the latest chapter of a book with few uplifting passages was written.
Though present-day incursions and clashes are driven by strategic motivations and regional politicking against the backdrop of the global war on terror, those centuries-old grudges, raids and musket-battles still shape events.
"In Ethiopia, the damage which Gragn did has never been forgotten," Ethiopia expert, Paul Henze, wrote in a book on the country's history, Layers of Time.
"Every Christian highlander still hears tales of Gragn in his childhood. I have often had villagers in northern Ethiopia point out sites of towns, forts, churches and monasteries destroyed by Gragn as if these catastrophes had occurred only yesterday."
Though Gragn's ethnicity is disputed by historians, Ethiopians know his army was overwhelmingly manned by ethnic Somalis, and that stings.
DELICATE RELATIONS, COMPLEX HISTORY
Somalis, too, are haunted by past Ethiopian invasions.
Ethiopia and Somalia still hand-pick powerful allies keen to win clout in the Horn of Africa.
Its location on the Gulf of Aden and its potential as a base for militant Islam make it an ideal arena for proxy wars, influence-peddling and diplomatic skullduggery.
The two countries - Ethiopia then supported by the Soviet Union and Cuba and Somalia supported by the United States - fought one of their many wars over Ethiopia's mainly ethnic-Somali Ogaden region in 1977-1978.
Ethiopia's victory was helped by some crack Cuban troops, a modern day echo of the foreigners who helped in the sixteenth century. Since then, Western and Eastern powers have switched allegiances, depending on the politics of those in power.
These days, Ethiopia, seen as a critical bulwark against the rise of Islamist militancy in the strategic region next to the world's busiest shipping lanes, is Washington's main ally.
"An unstable Horn of Africa could have a destabilizing effect on the world," a Western diplomat in the region told Reuters. "The U.S., Britain, China - and increasingly Turkey -are all trying to get a foothold here for both security reasons and economic reasons. Ethiopia makes the best ally right now."
But despite the leadership changes, and the temporary alliances in a region that is no stranger to pragmatic politics, that old animosity is playing out again.
ETHIOPIA. WHO ELSE?
At the centre of the latest episode between the two nations is the Islamist rebel group, al Shabaab, which has declared holy war on the still mostly-Christian Ethiopia, and threatened to launch suicide attacks in its capital, Addis Ababa.
Neighboring Kenya sent troops across the border in October, unsettled by a spate of security attacks it blamed on the militants, with the aim of dismantling the rebels' networks.
Ethiopia watched closely, analysts say, unsure of whether the Kenyan intervention would work. Finally, a month ago, with the Kenyans stalled, its troops moved into Somalia to arm and train the pro-government militia Ahlu Sunna Waljamaca (ASWJ).
Such is the delicacy, that Ethiopia has not admitted publicly to its latest incursion despite scores of testimony from local witnesses, elders and reporters.
"The knowledge of history as well as the unwillingness to hand al Shabaab the propaganda coup, just when the terrorist group is weakened, probably has a great deal to do with Ethiopia's reluctance to do more than build up the capacity of local Somali allies like ASWJ and to try to politically unite them in a common effort," J. Peter Pham, Africa director with the Atlantic Council, told Reuters.
Until now, Ethiopia had seemed reluctant to get involved in Somalia again after a 2006-2009 incursion to overthrow another Islamist group that had taken over Mogadishu sparked such ire among some Somalis that al Shabaab rose from its ashes.
This time, the Ethiopians say, their hand was forced.
"Somebody needed to go in and help. Somalia is the world's biggest security problem and that threatens everybody," an Ethiopian official told Reuters.
"We're aware that, for some Somalis, we are not the best choice and that is why we are being careful. But, yet again, who else?"
(Editing by David Clarke and Maria Golovnina)