The Maldives' parliament has overwhelmingly voted the country's first democratically elected president as the speaker of the house.

Mohamed Nasheed received 67 votes from among 87 members. His rival received 17 votes past midnight Tuesday.

The speaker also has a role in the Judicial Services Commission that regulates the Supreme Court, and is third in line should the positions of the president and vice president become vacant.

President Ibrahim Mohamed Solih's Maldivian Democratic Party has swept the parliamentary elections, winning 65 out of 87 seats. Last year, Solih defeated strongman Yameen Abdul Gayoom in the presidential vote.

The elections paved the way for Nasheed's return home after years in exile. He was elected president of the Indian Ocean archipelago in 2008 until 2012.