Tunisia's President Beni Caid Essebsi, the North African country's first democratically elected leader, has died at the age of 92, according to the presidency.
One of the world's oldest leaders, Essebsi died at the Tunis military hospital on Thursday.
He was hospitalised with a severe illness in late June, but returned to intensive care on Thursday, his son said. Earlier, Hafedh Caid Essebsi told AFP news agency that "things are not going well".
Drafted in as prime minister in 2011 after longtime ruler Zine El Abidine Ben Ali was toppled, Essebsi was elected president three years later, becoming the country's first directly elected head of state after its "Arab Spring" uprising.
He co-brokered a historic power-sharing deal between his Nidaa Tounes movement and Islamist party Ennahda that helped to steady the country, but the tie-up later frayed and Nidaa Tounes fractured into political infighting centring on Essebsi's son, who became party leader.
Though Tunisia remained a democratic exception in a troubled region, critics accused Essebsi of attempting a dynastic handover, rowing back on post-revolution freedoms, and failing to support a truth commission seeking justice for the victims of authoritarian rule.
Essebsi recently announced he would not run in the election scheduled for November, saying a younger person should lead the country.
Concerns had been growing about his fitness for office after he was hospitalized three times in recent weeks.
Politicians and social media users have expressed worry over a potential power vacuum ahead of November polls and called for greater transparency about the president's health.
Tunisia's constitution, adopted in 2014, provides two measures in the case of a power vacuum.
The prime minister can take over the president's responsibilities for a period of no more than 60 days.
If the vacancy is longer, the speaker of parliament is tasked with the role for up to 90 days.
In both cases, the decision must be taken by a constitutional court after it validates the president's incapacity.
But eight years after the Arab Spring, Tunisia has yet to set up a constitutional court.
Presidential elections are scheduled for November 17, after parliamentary elections which have been set for October 6.