Mogadishu - Mohamed Abdullahi Farmajo was elected Somali president Wednesday, in the second presidential election since 1991 held amid tight security due to clashes between Al-Qaeda-linked fighters and African Union peacekeepers.Following is a timeline of developments over the past 25 years in the war-torn country:President Barre deposed, chaos ensues In January 1991, President Mohamed Siad Barre, a strongman in power since 1969, is deposed by rebels and flees the country. The rebel alliance soon falls apart and clan-based fighting breaks out later that year.From December 1992 to 1995, the international community intervenes with 38 000 troops to end a major famine and restore peace, but the United Nations' mission ends in failure and the deaths of 18 US soldiers.New government barred from Mogadishu In 2005, a new government formed the previous year after protracted talks in Kenya enters the country but cannot reach Mogadishu, which is controlled by warlords. The authorities set up shop in Baidoa, west of the capital.A year later, the Islamic Courts movement, accused by the US of harbouring Al-Qaeda extremists, captures Mogadishu after heavy fighting.Shabaab emerges, joins Al-Qaeda Ethiopia invades Somalia in December 2006 with Washington's support. The Shabaab, the Islamic Courts' armed wing, emerges to stage a bloody insurgency in the capital and the south.In 2007, an African Union (AU) force deploys in Mogadishu to back up a transitional federal government, which comes to the capital.Ethiopia withdraws from Somalia in 2009, and days later, the Shabaab seizes Baidoa while the UN holds talks in Djibouti with the entire Somali parliament. Islamist leader Sheikh Sharif Sheikh Ahmed becomes president of a transitional administration.In 2010, Shabaab proclaims its allegiance to Al-Qaeda and claims a double attack that kills 76 people in Kampala in retaliation for Uganda's participation in the AU force.AU troops drive Shabaab militants out of Mogadishu in August 2011 but the militants continue to control rural areas and launch repeated attacks in the capital. In October 2011, a Shabaab suicide bombing at a ministry in Mogadishu kills 82 people. In late October, Kenyan troops cross the border into southern Somalia and Ethiopian forces follow in November.Shabaab fighters strike back at the Westgate Mall in Nairobi on September 21, 2013 where at least 67 people are killed and around 20 go missing, in retaliation for Kenya's military intervention. In April 2015, another Shabaab attack kills 148 people at the university in Garissa, eastern Kenya.Parliamentary, presidential elections A new Somali parliament is sworn in on August 20, 2012 following the adoption of a provisional constitution.The new parliament, comprised of deputies nominated by 135 clan elders, elects Hassan Sheikh Mohamud as president on September 10. It is the first presidential election in Somalia since Barre was deposed in 1991. From October to December 2016, around 14 000 clan-based delegate electors - from a total population of 12 million - vote in a second parliamentary election. On December 27, 2016, a new batch of 275 Somali deputies take the oath of office.On February 8, 2017 former premier Farmajo is elected president after incumbent Mohamud admits defeat in a second round of voting by lawmakers.