UNITED NATIONS (AP) — The U.N. envoy for Somalia said the Cabinet agreed Thursday on a model for elections later this year, calling the long-awaited decision "an important milestone" for the impoverished Horn of Africa nation grappling with Islamic extremist insurgents.

Michael Keating, who took over as special representative this month, told the U.N. Security Council that the Cabinet decision was the culmination of almost six months of intense consultations and "may be a watershed moment."

Somalia has been trying to rebuild after establishing its first functioning central government since 1991, when warlords overthrew a longtime dictator and turned on each other, plunging the impoverished nation into chaos. Al-Shabab rebels were ousted from the capital, Mogadishu, in 2011 and have been pushed out of other key cities but they are not yet defeated, and the government remains weak.

Keating said the security situation remains "very challenging" and called al-Shabab "a potent threat," noting two terrorist attacks in just the last two weeks.

Somalia also faces a serious humanitarian situation: 4.9 million people, representing 40 percent of the population, in need of assistance, over 1.1 million internally displaced, some 300,000 children under the age of five acutely malnourished, and millions without basic healthcare, water and sanitation, Keating said.

At the same time, the U.N. envoy stressed the importance of the newly agreed electoral model, which he praised for being an entirely Somali creation.

The U.N.'s Security Council said "holding a peaceful, transparent electoral process in 2016 will mark a historic step forward for all Somalis, and will be fundamental for the country's continued progress towards democracy and stability." U.N. Secretary-General Ban Ki-moon welcomed the decision and called on all parties to urgently establish a roadmap to universal elections in 2020 "to ensure continued momentum in the country's transition to democracy."

The current non-elected parliament of the transitional government, sworn in in 2012, expires this year.

Keating said the new electoral model envisions a 275-member lower house which maintains a power-sharing formula among clans and a 54-member upper house based on equal representation of existing, emerging and prospective federal states plus additional seats for Puntland and Somaliland.

It also requires that a minimum of 30 percent of seats be reserved for women.

While "the decision marks an important milestone for Somalia," Keating said, "there are many more ahead (and) the journey will be long and bumpy."