CARTHAGE, Tunisia (Reuters) - Tunisians bid farewell to their first democratically elected president Beji Caid Essebsi at a state funeral on Saturday attended by foreign leaders including French President Emanuel Macron and Qatar’s Emir, Sheikh Tamim bin Hamad Al Thani.

Essebsi, who helped guide the North African country’s transition to democracy after the 2011 revolution, died aged 92 on Thursday.

Tens of thousands of Tunisians lined up the streets of Tunis waving flags, chanting the national anthem and throwing roses at the funeral procession as it made its way from the presidential palace in Carthage to the Al Jallaz cemetery where Essebsi was buried.

“Goodbye president, goodbye Bajbouj,” they shouted, referring to Essebsi’s nickname.

The Tunisian red and white flag covered the late president’s coffin, which was placed on a military truck. A flypast by the military made white and red smoke in the air.

Other dignitaries at the funeral included Algerian President Abdelkader Ben Saleh, Palestinian President Mahmoud Abbas, and King Felipe VI of Spain.

Macron gave a speech at the palace, saying that Essebsi had “supported the stability of the constitution, the attachment to freedom and openness ... and equality between women and men”.

Slideshow ( 26 images )

SMOOTH TRANSITION

Hours after Essebsi’s death, parliament speaker Mohamed Ennaceur was sworn in as interim president in line with the constitution in a smooth transition of power. The electoral commission announced a presidential election for Sept. 15, two months earlier than scheduled.

“He spent his life in the service of Tunisia, preserving its gains and defending its values,” Ennaceur said in his speech. “He was a man of consensus, dialogue and national unity.”

A parliamentary vote is set for Oct. 6.

Many roads have been closed and security forces deployed in most areas of Tunis and near the Al Jallaz cemetery.

Thousands filled the capital’s Habib Bourguiba Avenue, a focal point of the 2011 revolution that sparked uprisings across the Arab world, known as the Arab Spring.

Slideshow ( 26 images )

“It is a sad day for Tunisia,” said a woman named Nabila. “We lost a great statesman who had a big role after 2011 revolution and helped unite Tunisians and ease historical differences with the Islamists.”

Essebsi’s rise to prominence after the overthrow of veteran autocrat Zine El-Abidine Ben Ali was followed by revolts against authoritarian leaders across the Middle East and North Africa, including in Libya and Egypt.

In 2012 Essebsi, who served as parliament speaker under Ben Ali, founded the secular Nidaa Tounes party, now part of the governing coalition, to counter-balance the resurgence of Islamists who were suppressed under Ben Ali. Two years later, Essebsi became Tunisia’s first freely elected head of state.

The former French colony has been hailed as the only democratic success of the Arab Spring uprisings, with a new constitution, free elections and a coalition government of moderate Islamist and secular parties in a region otherwise struggling with upheaval.

But political progress has not been matched by economic advances. Unemployment stands at about 15%, up from 12% in 2010, due to weak growth and low investment.

Essebsi also faced criticism that he was seeking a return to a strong state with power concentrated in the presidency, whose role is limited to foreign and defense policies under the new constitution.