Pakistan's former president General Pervez Musharraf, who seized
power in a coup in 1999, has died aged 79.
The former leader - who was president between 2001 and 2008 - died in Dubai after a long illness, a statement from the country's army said.
He had survived numerous assassination attempts, and found himself on the front line of the struggle between militant Islamists and the West.
He supported the US "war on terror" after 9/11 despite domestic opposition.
In 2008 he suffered defeat in the polls and left the country six months later.
When he returned in 2013 to try to contest the election, he was arrested and barred from standing. He was charged with high treason and was sentenced to death in absentia only for the decision to be overturned less than a month later.
He left Pakistan for Dubai in 2016 to seek medical treatment and had been living in exile in the country ever since.
Musharraf died in hospital on Sunday morning. His body will be flown back from the United Arab Emirates to Pakistan on a special flight after his family submitted an application to do so, local TV channel Geo News reports.
In the statement Pakistan's military expressed its "heartfelt condolences" and added: "May Allah bless the departed soul and give strength to bereaved family."
Pakistan's President Arif Alvi prayed "for eternal rest of the departed soul and courage to the bereaved family to bear this loss."
Pakistan's Prime Minister Shehbaz Sharif also expressed his condolences, as did the country's military leaders.
A career marred by controversy
Musharraf's rule was characterised by extremes. He was credited by some with turning around the economic fortunes of the country while leader.
He was embroiled in a number of court cases following his loss of power, including accusations of failing to provide adequate security for former Pakistani Prime Minister Benazir Bhutto, whose assassination by the Taliban in 2007 shocked Pakistan and the world.
And his career ultimately ended in disgrace and arrest, when he was sentenced to death in absentia for treason in 2019. Though that sentencing was later reversed, he never returned to Pakistan.
Despite these events, Fawad Chaudhury, a former aide of Musharraf and currently a senior leader of former Prime Minister Imran Khan's party, praised Musharraf and the influence he had on Pakistan.
"He is called a military dictator, but there has never been a stronger democratic system than that under him... Pervez Musharraf led Pakistan at a very difficult time, and Pakistanis believe the era of his reign was one of the best in Pakistan's history," Mr Chaudhury said in comments cited by Reuters.
However, the CEO of Islamabad-based think tank Tabadlab, Mosharraf Zaidi, said Musharraf was responsible for the "destruction of Pakistan" during his rule.
His time in power also divided opinion in India.
Musharraf's involvement while serving as the leader of the country's army in the Kargil conflict in May 1999 - when Pakistani generals secretly ordered an operation to occupy heights in Kargil on the Indian side - caused many in India to view him as an adversary.
But in one Indian politician's eyes, Musharraf redeemed himself during his presidency. "Once an implacable foe of India, he became a real force for peace 2002-2007," Shashi Tharoor, a former UN diplomat, said.
Mr Tharoor said he met Musharraf annually in those years at the UN, and described him as "smart, engaging and clear in his strategic thinking".