Somali MPs were choosing a president under tight security on Wednesday, with roads closed and residents urged to remain indoors over fears of an attack on the capital by al-Shabaab.

A protracted vote began on Wednesday after 14,000 elders and prominent regional figures chose 275 members of parliament and 54 senators, who in turn now choose whether to back President Hassan Sheikh Mohamud for a second term or one of 21 rivals.

Fears of attacks by al-Shabab, an armed group, have limited the election to the country’s legislators, who will vote at a heavily-guarded former air force base in the capital, Mogadishu.

Earlier on Wednesday,  gunmen stormed a hotel in the semi-autonomous Puntland region, killing four guards.

Several rounds of voting are expected to narrow down the large field of candidates. One candidate dropped out on Wednesday before the voting started.

Al Jazeera’s Mohammed Adow, reporting from the capital Mogadishu, said sources within the parliament had confirmed that huge sums of money were paid by some of the candidates and rival presidential candidates have accused each other of buying the loyalty of MPs, drawing furious denials.

“One member of the parliament told me that he received thousands from one of the presidential candidates,” he said. “There is lot at stake here. This election is supposed to bring leadership that heals the country but if corruption plays an important role, many doubt whether Somalia is going to be on the right road.”

President Mohamud, who has led the country since 2012 as it tries to rebuild after more than two decades of war and chaos, has the support of about a third of MPs, political analysts say, giving him an edge but not a guarantee of victory.

The threat from al-Shabab, who regularly launch attacks in Mogadishu and elsewhere, meant the government and its Western backers to go back on a promise to give each adult a vote due to what they say was the challenge of securing polling stations.

“We have tightened security and have confidence the new lawmakers will elect or re-elect a candidate they believe can save Somalia,” Major Hussein Nur, a police officer told the Reuters news agency.