A militant Pakistani cleric and about 50 of his supporters have been killed after troops stormed a mosque in Islamabad, government officials say.
Abdul Rashid Ghazi's body was found in the Red Mosque basement. Officials said he had been caught in the cross-fire.
The army says eight soldiers were also killed in the military operation, and about 50 women and children rescued.
Students at the mosque and its attached religious schools have waged a campaign for months pressing for Sharia law.
Public anger in the capital had been mounting after they kidnapped policemen as well as people they considered to be involved in immoral, un-Islamic activities.
The BBC's M Ilyas Khan in Islamabad says the military operation is a gamble for President Pervez Musharraf who risks a backlash from supporters of those inside the mosque.
In recent days the army has redeployed thousands of troops in north-western Pakistan where pro-Taleban militants opposed to President Musharraf have been carrying out a string of attacks said to be linked to the mosque siege.
Troops attacked the mosque overnight and took control of most of the complex during heavy fighting which raged as they went from room to room throughout the day.
As darkness fell once more the gunfire died down, though sporadic explosions have been heard.
The military say the operation to take control of the mosque is in its final stages and will continue throughout Tuesday night.
Interior Ministry spokesman Javed Iqbal Cheema said Mr Ghazi was killed as troops were flushing out militants still inside a madrassa (religious school) for women and girls inside the mosque compound.
RED MOSQUE STAND-OFF
3 July: Clashes erupt at mosque, 16 killed, after long student campaign for Islamic Sharia law
4 July: About 700 students leave mosque, now besieged by security forces; mosque leader caught trying to flee wearing woman's burka
5 July: More than 1,000 students surrender to security forces
6 July: Women are allowed to leave the mosque; students' deputy leader says he would rather die than surrender
8 July: Ministers say wanted militants are holding women and children inside the mosque
9 July: Negotiators talk to mosque leader via loudspeaker without progress; three Chinese workers are killed in Peshawar over siege
10 July: Pakistani troops storm mosque after failure of talks
"He was spotted in the basement and asked to come out. He came out with four or five militants who kept on firing at security forces," Mr Cheema told AFP news agency.
"The troops responded and in the cross-fire he was killed."
Brig Cheema said Mr Ghazi had used a number of women and children as "human shields", although the cleric always denied taking anyone hostage.
Mr Ghazi was deputy leader of the Lal Masjid (Red Mosque). His brother, Maulana Abdul Aziz, who was head, was arrested trying to escape last week dressed in a burka.
Hours before his death, Mr Ghazi accused the authorities of "naked aggression".
"My martyrdom is certain now," he told Pakistan's Geo television station.
It is not clear how many people were inside the complex when it was stormed.
In addition to those killed, about 70 militants had been captured or surrendered, the army said earlier.
One of the women rescued was said to be the wife of captured mosque leader Maulana Abdul Aziz.
Security forces began a full-scale siege of the Lal Masjid last Tuesday, not long after mosque students abducted seven Chinese workers they accused of running a brothel.
The government had said it wanted to detain a number of people on a wanted list, and also a number of foreigners whom it said were inside.
Talks reportedly broke down over the militants' demand for an amnesty for all in the mosque.
The authorities said "hardcore terrorists" were inside the mosque, some belonging to Jaish-e-Mohammad, an outlawed radical Muslim organisation which has been linked to al-Qaeda.
Mr Ghazi denied the presence of any banned extremist groups. He said those inside were students of his religious school.
THE RED MOSQUE SIEGE
1 Special forces attack compound from three sides and breach mosque walls
2 Fierce fighting between military and militants on mosque roof
3 Military take control of mosque and clear building
4 Militants fire from mosque minarets as action switches to madrassa
5 Chief cleric Abdul Rashid Ghazi was said to be holed up in its basement, with women and children