MOGADISHU, Somalia — Somali lawmakers have elected the former defense minister as the new speaker of the parliament Monday.

Mohamed Mursal Sheikh, a close ally of the Somali president, comes nearly three weeks after his predecessor resigned, ending weeks of a political crisis that donors feared might threaten recent security and political gains in this troubled country.

Sheikh, a former ambassador to Turkey, was early this year appointed defense minister, a position he quit nearly two weeks ago to follow an electoral rule which requires candidates running for the post of speaker to resign other positions to be a contestant.

Sheikh is expected to work to improve the President Mohamed Abdullahi Mohamed's influence in parliament.