Asif Farooqui of the BBC's Urdu service profiles Abdul Rashid Ghazi who led the last of the resistance in Islamabad's Red Mosque to Pakistan's security forces.
Mr Ghazi said he would rather die than surrender
Pakistani cleric Abdul Rashid Ghazi moved in liberal circles and favoured Western-style clothes as a young man, but was radicalised later in life.
His father, Maulana Abdullah, founded Islamabad's Lal Masjid (Red Mosque) and served as its head from when it was built in the late 1960s.
Maulana Abdullah's murder in 1998 left Abdul Rashid Ghazi a changed man and appears to have marked the start of his transformation from moderate to militant.
He came into the public limelight in 2001 when Pakistan's religious parties formed an alliance against the US invasion of Afghanistan.
After that he was accused of plotting to kill President Musharraf and of having numerous links with Islamic militants.
Struck from father's will
Abdul Rashid Ghazi's father came from a poor and religious family in Rajanpur district in southern Punjab.
The real problems between [Ghazi] and the state developed in 2004, over the operation against pro-Taleban militants in Pakistan's tribal areas
The family belongs to the Baloch Mazari, a warrior tribe from southern Punjab and north-eastern Balochistan.
Maulana Abdullah's circle of influence included senior government officials and politicians and he was said to be very close to former military ruler Gen Zia-ul-Haq.
In 1998, Maulana Abdullah was assassinated in the courtyard of the Red Mosque. According to his will, his elder son, Maulana Abdul Aziz, replaced him as the mosque's khateeb (the person who delivers the sermon).
Abdul Aziz was always seen as the obedient son, who quietly followed in his father's footsteps. But his younger brother was quite different.
From the very first, Abdul Rashid Ghazi refused to receive any sort of formal Islamic education. He enrolled at a madrassa (religious school) under pressure from his father, but soon ran away.
He refused to grow a beard, and went to the secular Quaid-e-Azam University in Islamabad, later graduating with a master's degree in international relations. He then applied for and got a job with the Ministry of Education.
Abdul Rashid Ghazi also refrained from using the title Hafiz (someone who has memorised the Koran). So displeased was his father by his un-Islamic lifestyle that he made his elder son sole heir in his will.
Troops besieged the mosque in the heart of the capital
After his father's murder, Abdul Rashid Ghazi started to take an interest in the affairs of the mosque and the madrassa attached to it and also grew a beard.
But he continued his job with the Ministry of Education. His elder brother, meanwhile, encouraged his Islamic re-education, and made him his deputy in the mosque and heir apparent.
In 2001, Abdul Rashid Ghazi became a central leader of the religious alliance opposed to the US invasion of Afghanistan, making passionate speeches about defending the country at daily demonstrations in Islamabad.
But the real problems between him and the state developed in 2004, over the operation against pro-Taleban militants in Pakistan's tribal areas.
Like other religious leaders, Abdul Rashid Ghazi also condemned the operation and used the Red Mosque to wage a campaign against it.
During this time the mosque issued a fatwa or religious edict which said that soldiers dying in the campaign should described as "killed", while the militants' dead were to be called "martyrs". This enraged President Musharraf and the army.
Soon after, the government announced that Abdul Rashid Ghazi had been involved in a plot to blow up the president's house, the parliament building and army headquarters on Pakistan's independence day.
Abdul Rashid Ghazi went underground, and the government presented an explosive-filled truck owned by him as evidence of his involvement to the media.
Some time later the minister for religious affairs, Ejaz-ul-Haq, held a press conference saying that Abdul Rashid Ghazi had not been involved in the plot and the real culprits had been arrested and charged.
These were said to be men belonging to the tribal areas and included Uzbek militants. It had also been established, officials said, that they had regularly visited the Red Mosque.
Further investigations apparently revealed that Abdul Rashid Ghazi had close contacts with militants in Pakistan's tribal area of Waziristan.
The cleric's first known gun battle took place when armed men tried to assassinate him in Islamabad. But he and his bodyguards using AK-47 rifles fought them off.
Since then, Abdul Rashid Ghazi always travelled around armed. He had an AK-47 in his car, near his work desk and near his bed when he slept.