Thousands of people attended funeral prayers on Tuesday for Pakistan's former military ruler Pervez Musharraf, who became a key US ally during the "war on terror".

Musharraf, who fled Pakistan in 2016 after a travel ban on him was lifted, died on Sunday aged 79 in Dubai, having suffered a long illness.

Prayers were held at the grounds of a military compound in Karachi in a ceremony attended by around 10,000 people, mostly retired and serving military officers, an AFP reporter observed.

Neither the serving army chief, the prime minister, nor the president attended the funeral, which was not officially announced by the military or government and was not aired on local television.

The body was set to be transported to a nearby military graveyard.

In Pakistan, where the military is supremely powerful and enjoys significant support, Musharraf remains a divisive figure.

In an editorial published by the country's leading English language newspaper on Monday, Musharraf was described "as something of an enigma as his authoritarian rule was also interspersed with liberal reforms".

"Yet the late general's mistakes were considerable, the biggest and most unforgivable being the derailing of the constitutional order."

- Economic boom, democratic decline -

The four-star general seized power in a 1999 bloodless coup and was acting simultaneously as Pakistan's army chief, chief executive, and president when the 9/11 attacks on the United States took place.

He became Washington's chief regional ally during the invasion of neighbouring Afghanistan, a decision which put him in the crosshairs of Islamist militants, who made several attempts on his life.

But it also brought in a huge influx of foreign aid, which bolstered the economy.

The general twice suspended the constitution and was accused of rigging a referendum shoring up his power, as well as rampant rights abuses including rounding up opponents during his nearly nine-year rule.

In 2007, Musharraf ordered troops to storm a mosque in Islamabad where more than a hundred students calling for the imposition of Sharia law were killed, sparking a major militant backlash.

In the same year, he attempted to challenge the independence of the judiciary, leading to widespread protests, and was accused of involvement in the assassination of opposition leader Benazir Bhutto.

He became increasingly isolated before ultimately losing power and leaving many Pakistanis with a deep distaste for direct military rule.

- 'Terrible and sad legacy' -

Pakistan's Prime Minister Shehbaz Sharif offered a simple condolence message on the death of Musharraf, who seized power after ousting his brother Nawaz Sharif.

Coalition partner and Foreign Minister Bilawal Bhutto Zardari, the son of former prime minister Benazir Bhutto, remained silent.

Khurram Dastagir, federal minister and a central leader of the governing PMLN party, said Tuesday that Pakistan should "forgive but not forget".

"He plunged Pakistan into a war on terror, crushed the rights of people in Balochistan," he told local television channel Geo News.

"The constitution and judiciary of Pakistan were crushed... his role in tortures and detentions... it is a very terrible and sad legacy that Pervez Musharraf has left and we should not forget it."

Musharraf had been suffering from a rare disease known as amyloidosis and last summer his family said he had no prospect of recovery.

His body was repatriated from Dubai on Monday and flown to the megalopolis, where his family settled after leaving Old Delhi following the partition of the Indian subcontinent.